Understand How a Smart Home Skill Works
An Alexa smart home ecosystem contains the following:
- Customer: The person interacting with the Alexa-enabled device and owner of cloud-enabled devices
- The Smart Home Skill API: A service that understands the voice commands and converts them to directives (JSON messages) that are sent to smart home skills
- AWS Lambda: A compute service offered by Amazon Web Services (AWS) that hosts the smart home skill code, which is called a skill adapter
- Smart home skill: Code and configuration that interpret directives and send messages to a device cloud
- Device cloud: The cloud environment provided by a device vendor that controls and manages the customer’s cloud-enabled devices
- A customer who has previously added devices or scenes to their device cloud says, “Alexa, turn on the kitchen light” to their Amazon Echo or other Alexa-enabled device.
- The Amazon Echo or other Alexa-enabled device hears this instruction and sends it to the Alexa service for interpretation.
- The Alexa Smart Home Skill API interprets the action as "turn on" and the device name as "kitchen light". It composes a message to send to the skill adapter that controls the kitchen light. This message is called a directive.
The directive includes:
- The action (turn on)
- The device identifier (an ID representing the device that the customer named "kitchen light")
- Information authenticating the customer
- The skill adapter receives and parses the request for the action, the device identifier and authentication details. It uses this information to communicate with the device cloud. The skill adapter generates a message to the customer's device cloud, and tells the kitchen light to turn on.
- The device cloud gets the message and the kitchen light turns on.
- The skill adapter sends a response back to the Smart Home Skill API indicating whether it was successful. Alexa uses this response to determine the appropriate response to the customer. For example, Alexa might say, “OK” to indicate the requested is complete. (not shown in diagram)
Who Can Develop Smart Home Skills for Alexa
Anyone can develop a smart home skill. Developing smart home skills is easy because the voice interactions are defined by Amazon. The Alexa service knows how to interpret the user’s speech and what messages to send to your smart home skills.
Generally, smart home skill development falls into two categories:
- Developers who represent cloud-connected device manufacturers that want to enable customers to interact with those devices using their voice
- Developers who want to create an Alexa skill for cloud-connected devices, either for their own private use or general public use (certification required for public use)
Prerequisites to Smart Home Skill Development
In order to develop a Smart Home Skill you must have the following:
- An Amazon developer account. Sign up is free
- A connected device with a cloud API to control it
- An Alexa-enabled device such as Amazon Echo
- An AWS account. You host your skill adapter as an AWS Lambda function
- Knowledge of Java, Node.js, or Python as Lambda functions can be written in any of these languages
- A basic understanding of OAuth 2.0