Alexa.ColorController Interface 3
Implement the Alexa.ColorController
interface in your Alexa skill so that users can change the color of devices such as color-changing light bulbs. For more details about Smart Home skills, see Understand Smart Home Skills.
For the list of languages that the ColorController
interface supports, see List of Alexa Interfaces and Supported Languages. For the definitions of the message properties, see Alexa Interface Message and Property Reference.
Utterances
When you use the Alexa.ColorController
interface, the voice interaction model is already built for you. After the user says one of the following utterances, Alexa sends a corresponding directive to your skill.
The following examples show some user utterances:
Alexa, set the front porch light to blue.
Alexa, change the kitchen to the color blue.
Alexa, schalte das Wohnzimmerlicht hellblau.
Alexa, règle la lumière du vestibule en bleu.
Alexa, mets la cuisine en bleu.
Alexa, फ्रंट पोर्च लाइट को ब्लू पर सेट करें।
Alexa, किचन को नीले रंग में बदलें।
Alexa, imposta la luce del portico anteriore su blu.
Alexa, cambia la cucina con il colore blu.
アレクサ、寝室のライトを青にして
アレクサ、キッチンをオレンジ色に変えて
Alexa, coloque a luz da entrada em azul.
Alexa, mude luz da entrada para azul.
Alexa, coloque a luz da cozinha em vermelho.
Alexa, mude luz da cozinha para vermelho.
Alexa, pon la luz del porche delantero en azul.
Alexa, cambia la cocina al color azul.
Alexa, zet het licht op de veranda op blauw.
Alexa, verander de keuken naar de kleur blauw.
Reportable properties
The color
property represents the color of an endpoint. Colors are specified by using the hue, saturation, brightness (HSB) color model. For more details, see colorizer.org and The HSB Color System.
Discovery
You describe endpoints that support Alexa.ColorController
using the standard discovery mechanism described in Alexa.Discovery.
Set retrievable
to true for all the interfaces and properties that you report when Alexa sends your skill a state report request. Set proactivelyReported
to true for interfaces and properties that you proactively report to Alexa in a change report.
For the full list of display categories, see display categories.
To let Alexa know the health of your device, also implement the Alexa.EndpointHealth
interface.
Discover response example
The following example shows a Discover.Response
message for a light that supports the Alexa.PowerController
and Alexa.ColorController
interfaces.
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"payloadVersion": "3",
"messageId": "Unique identifier, preferably a version 4 UUID"
},
"payload": {
"endpoints": [
{
"endpointId": "Unique ID of the endpoint",
"manufacturerName": "Manufacturer of the endpoint",
"description": "Description to be shown in the Alexa app",
"friendlyName": "Living Room light",
"displayCategories": ["LIGHT"],
"additionalAttributes": {
"manufacturer": "Manufacturer of the endpoint",
"model" : "Model of the device",
"customIdentifier": "Optional custom identifier for the device"
},
"cookie": {},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.ColorController",
"version": "3",
"properties": {
"supported": [
{
"name": "color"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [
{
"name": "connectivity"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
}
]
}
]
}
}
}
Directives
Alexa sends the following Alexa.ColorController
interface directives to your skill.
SetColor directive
Support the SetColor
directive so that users can change the color of devices.
The following examples show user utterances:
Alexa, set the bedroom light to red.
Alexa, schalte das Wohnzimmerlicht rot.
Alexa, règle la lumière de la chambre en rouge.
Alexa, बेडरूम की लाइट को लाल रंग में सेट करो।
Alexa, imposta la luce della camera da letto sul rosso.
アレクサ、寝室のライトを赤に変えて
Alexa, coloque a luz do quarto em vermelho.
Alexa, mude luz do quarto para vermelho.
Alexa, pon la luz del dormitorio en rojo.
Alexa, zet de slaapkamerlamp op rood.
SetColor directive example
The following example illustrates a SetColor
directive that Alexa sends to your skill.
SetColor
directive specifies hue = 0, saturation = 1, and brightness = 1. Here, set the hue to 0, the saturation to 1, and ignore the brightness value of 1 in the directive. Instead, maintain the current brightness value of 0.5.{
"directive": {
"header": {
"namespace": "Alexa.ColorController",
"name": "SetColor",
"messageId": "Unique version 4 UUID",
"correlationToken": "Opaque correlation token",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "OAuth2.0 bearer token"
},
"endpointId": "Endpoint ID",
"cookie": {}
},
"payload": {
"color": {
"hue": 350.5,
"saturation": 0.7138,
"brightness": 0.6524
}
}
}
}
SetColor directive payload
The following table shows the payload details for the SetColor
directive.
Property | Description | Type | Required |
---|---|---|---|
|
Color to set the device to. |
Object |
Yes |
SetColor response
If you handle a SetColor
directive successfully, respond with an Alexa.Response
event. In the context object, include the values of all properties that changed. You can respond synchronously or asynchronously. If you respond asynchronously, include a correlation token and a scope with an authorization token.
The following example shows a SetColor
response.
{
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "OAuth2.0 bearer token"
},
"endpointId": "Endpoint ID"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.ColorController",
"name": "color",
"value": {
"hue": 350.5,
"saturation": 0.7138,
"brightness": 0.6524
},
"timeOfSample": "2019-07-03T16:20:50Z",
"uncertaintyInMilliseconds": 500
}
]
}
}
SetColor directive error handling
If you can't handle a SetColor
directive successfully, respond with an Alexa.ErrorResponse
event.
State reporting
Alexa sends a ReportState
directive to request information about the state of an endpoint. When Alexa sends a ReportState
directive, you send a StateReport
event in response. The response contains the current state of all the retrievable properties in the context object. You identify your retrievable properties in your discovery response. For details about state reports, see Understand State and Change Reporting.
StateReport response example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "StateReport",
"messageId": "Unique identifier, preferably a version 4 UUID",
"correlationToken": "Opaque correlation token that matches the request",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "OAuth2.0 bearer token"
},
"endpointId": "Endpoint ID"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.ColorController",
"name": "color",
"value": {
"hue": 350.5,
"saturation": 0.7138,
"brightness": 0.6524
},
"timeOfSample": "2019-07-03T16:20:50Z",
"uncertaintyInMilliseconds": 500
}
]
}
}
Change reporting
You send a ChangeReport
event to report changes proactively in the state of an endpoint. You identify the properties that you proactively report in your discovery response. For details about change reports, see Understand State and Change Reporting.
For lighting endpoints that support both the ColorController
and ColorTemperatureController
interfaces, report the state of color
when an endpoint is set to a color, and report the state of colorTemperatureInKelvin
when an endpoint is set to a shade of white.
ChangeReport event example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
"messageId": "Unique identifier, preferably a version 4 UUID",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "OAuth2.0 bearer token"
},
"endpointId": "Endpoint ID"
},
"payload": {
"change": {
"cause": {
"type": "PHYSICAL_INTERACTION"
},
"properties": [
{
"namespace": "Alexa.ColorController",
"name": "color",
"value": {
"hue": 280,
"saturation": 0.9,
"brightness": 0.9
},
"timeOfSample": "2024-02-03T16:17:00.00Z",
"uncertaintyInMilliseconds": 500
}
]
}
}
},
"context": {
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2024-02-03T16:15:00.00Z",
"uncertaintyInMilliseconds": 0
}
}
Related topics
Last updated: Aug 23, 2024