Alexa.BrightnessController Interface
Implement the Alexa.BrightnessController
interface in your Alexa skill so that users can control the brightness of devices, such as light bulbs. For more details about Smart Home skills, see Understand Smart Home Skills.
Use the BrightnessController
interface for devices that you know support brightness control instead of the more general Alexa.PercentageController interface. If you want to control the power level of an endpoint such as a dimmer switch, use the Alexa.PowerLevelController interface instead.
For the list of languages that the BrightnessController
interface supports, see List of Alexa Interfaces and Supported Languages.
Utterances
The Alexa.BrightnessController
interface uses the pre-built voice interaction model. The following examples show some customer utterances:
Alexa, dim the bathroom light.
Alexa, set the bedroom light to fifty percent.
Alexa, diminue la lumière de la salle de bains
Alexa, mets la lumière de la chambre à cinquante pour cent
Alexa, dimme das Licht um fünfundzwanzig Prozent.
Alexa, stelle das Licht auf fünfzig Prozent.
アレクサ、浴室の照明を暗くして。
アレクサ、浴室の照明を50パーセントにして。
After the customer says an utterance, Alexa sends a corresponding directive to your skill.
Properties
The brightness property
The Alexa.BrightnessController
interface uses the brightness
property as the primary property. The property is an integer and valid values from 0 to 100 inclusive. If the brightness
property is used to represent a change, then valid values are from –100 to 100 inclusive.
Discovery
You describe endpoints that support Alexa.BrightnessController
by using the standard discovery mechanism described in Alexa.Discovery.
Set retrievable
to true for all of 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.
Discover response example
The following example shows a Discover.Response
message for a light that supports the Alexa.BrightnessController
and Alexa.ColorController
interfaces.
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"payloadVersion": "3",
"messageId": "a unique identifier, preferably a version 4 UUID"
},
"payload": {
"endpoints": [
{
"endpointId": "unique ID of the endpoint",
"manufacturerName": "the manufacturer name of the endpoint",
"description": "a description that is shown in the Alexa app",
"friendlyName": "Living Room Light",
"displayCategories": ["LIGHT"],
"additionalAttributes": {
"manufacturer": "the manufacturer name of the endpoint",
"model" : "the model of the device",
"serialNumber": "the serial number of the device",
"firmwareVersion" : "the firmware version of the device",
"softwareVersion": "the software version of the device",
"customIdentifier": "your custom identifier for the device"
},
"cookie": {},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa.BrightnessController",
"version": "3",
"properties": {
"supported": [
{
"name": "brightness"
}
],
"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
SetBrightness directive
Support the SetBrightness
directive so that customers can set the brightness value of a device.
The following example shows a customer utterance:
Alexa, set the table light bulb to fifty percent.
Alexa, règle la lumière de la chambre à cinquante pour cent
Alexa, stelle das Licht auf fünfzig Prozent.
アレクサ、浴室の照明を50パーセントにして。
SetBrightness directive payload details
Field | Description | Type |
---|---|---|
brightness |
The percentage brightness to set the device to. | Integer |
SetBrightness directive example
The following example illustrates a SetBrightness
directive that Alexa sends to your skill.
{
"directive": {
"header": {
"namespace": "Alexa.BrightnessController",
"name": "SetBrightness",
"messageId": "message id",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "endpoint ID",
"cookie": {}
},
"payload": {
"brightness": 50
}
}
}
SetBrightness response event
If you handle a SetBrightness
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.
SetBrightness response event example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"messageId": "a unique identifier, preferably a version 4 UUID",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "endpoint ID"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.BrightnessController",
"name": "brightness",
"value": 50,
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 500
}
]
}
}
SetBrightness directive error handling
If you can't handle a SetBrightness
directive successfully, respond with an Alexa.ErrorResponse event.
AdjustBrightness directive
Support the AdjustBrightness
directive so that customers can adjust the brightness value of a device.
The following example shows a customer utterance:
Alexa, dim table light bulb twenty five percent.
Alexa, baisse la lumière de la salle de bains
Alexa, dimme das Licht um fünfundzwanzig Prozent.
アレクサ、テーブルライトの電球を25パーセント暗くして。
AdjustBrightness directive payload details
Field | Description | Type |
---|---|---|
brightnessDelta |
The amount by which to change the brightness. | Integer |
AdjustBrightness directive example
The following example illustrates an AdjustBrightness
directive that Alexa sends to your skill.
{
"directive": {
"header": {
"namespace": "Alexa.BrightnessController",
"name": "AdjustBrightness",
"messageId": "message id",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "endpoint ID",
"cookie": {}
},
"payload": {
"brightnessDelta": -25
}
}
}
AdjustBrightness response event
If you handle an AdjustBrightness
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.
AdjustBrightness response event example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"messageId": "a unique identifier, preferably a version 4 UUID",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "endpoint ID"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.BrightnessController",
"name": "brightness",
"value": 75,
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 1000
}
]
}
}
AdjustBrightness directive error handling
If you can't handle an AdjustBrightness
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 of 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 event example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "StateReport",
"messageId": "a unique identifier, preferably a version 4 UUID",
"correlationToken": "<an opaque correlation token>",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "endpoint ID"
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.BrightnessController",
"name": "brightness",
"value": 75,
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 1000
}
]
}
}
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.
ChangeReport event example
{
"event": {
"header": {
"namespace": "Alexa",
"name": "ChangeReport",
"messageId": "a unique identifier, preferably a version 4 UUID",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "<an OAuth2 bearer token>"
},
"endpointId": "endpoint ID"
},
"payload": {
"change": {
"cause": {
"type": "PHYSICAL_INTERACTION"
},
"properties": [
{
"namespace": "Alexa.BrightnessController",
"name": "brightness",
"value": 75,
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
}
]
}
}
},
"context": {
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
}
}