Today we are happy to announce the support for scenes, a new feature in Alexa skills developed with the Smart Home Skill API. With scenes, customers can issue a single voice command to an Alexa-enabled device such as the Amazon Echo or Echo Dot to set a predefined configuration of one or more devices to a desired state. For example, a customer could say, “Alexa, turn on bedtime” resulting with specific lights turning off, a bedroom light changing color to a low-lit orange-hue, a ceiling fan turned on, and the temperature changed to an ideal setting for sleep.
At first glance scenes might appear similar to the groups feature found in the Smart Home section of the Alexa app as both allow control over multiple devices with one voice command. However, scenes differ from groups in the following ways:
- Scenes allow each device configured within it to be set to a desired state, whereas groups are stateless and simply turn devices on or off.
- Scenes are configured by customers through a device manufacturer’s app, whereas groups are configured in the Alexa app.
- Scenes only contain devices managed by the device manufacturer’s app, whereas groups can contain any device discovered in the Alexa app.
With scenes customers have another option to groups for controlling multiple devices. Customers may already have scenes configured in device manufacturer apps such as those provided by Control4, Crestron, Insteon, Lutron Caseta, SmartThings, or Wink. Prior to today, these scenes were invoked by using the device manufacturer’s app. Now customers can find these scenes listed as devices in their Alexa app after requesting device discovery and control via voice interaction.
How Scenes Work
Figure 1: Scene control process
Once a customer has configured a scene through the device manufacturer’s app and requests a device discovery to Alexa, the scene name will appear in the device list in the Alexa app. Consider what happens from a developer perspective, when a voice command is made to turn a scene on.
Let’s examine each step above in more detail.
- Customer says, “Alexa, turn on bedtime.”
- Alexa service receives the request and routes this intent to the Smart Home Skill API.
- A directive is composed including the ‘TurnOnRequest’ name in the directive header and the appliance ID (located in directive payload) corresponding to the friendly name of the scene “bedtime.”
- The skill adapter hosted in AWS Lambda receives the directive. Included in the directive is an access token to determine the customer’s account making the request. A call is made to device cloud API to turn on the scene matching the appliance ID for the associated customer.
- The device cloud (likely owned by the device maker) receives a request from the skill adapter, and communicates to a device hub or controller to turn on the scene preconfigured by the customer.
- The device hub sets the desired state of each device configured by the customer. Note in this “bedtime” example, turning on a scene may result in turning off a light, since this could be the desired state of that device for the scene.
Managing Scenes in Code
If your skill is already handling requests for turning devices on or off, no further work is necessary in your skill adapter to do the same for scenes. This is because a scene is managed just like a single device. The real work to support scenes in your skill lies not in your skill adapter, but in your own device cloud and device app. The device app you create is needed for the customer to configure scenes. The device cloud contains code to make sure scenes are returned as a single device during device discovery and follow the following rules.
- Scenes should only be included in device discovery requests if the devices configured for the scene are approved. For more information, see scene discovery and allowed devices.
- Scenes need to adhere to formatting guidelines in the DiscoverApplianceResponse made by your skill adapter. For these guidelines, please consult requirement to describe a scene.
- Regardless of how many scenes a customer has configured, you must limit the number of scenes returned to twelve.
Please visit our documention on providing scenes in a smart home skill for more information. For more information on smart home skill development, review the following references.