Alexa.PowerLevelController Interface
The Alexa.PowerLevelController interface describes the messages used to control the power level of an endpoint. Use this interface for devices such as a power dimmer that supports power-level control instead of the more general Alexa.PercentageController interface.
Directives
This control and query directives in this interface are supported in skills that target the following languages:
- English (US)
- English (UK)
- English (India)
- German
See Develop Smart Home Skills in Multiple Languages for more information.
SetPowerLevel
Sets the power level value for an endpoint.
Example Request:
{
"directive": {
"header": {
"namespace": "Alexa.PowerLevelController",
"name": "SetPowerLevel",
"messageId": "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4",
"correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "some-access-token"
},
"endpointId": "appliance-001",
"cookie": {}
},
"payload": {
"powerLevel": 42
}
}
}
Payload details
| Field | Description | Type | Required |
|---|---|---|---|
| powerLevel | Indicates the desired power level for the device. | An integer between 0 and 100, inclusive. | Yes |
AdjustPowerLevel
Increases or decreases the power level of an endpoint by the specified percentage.
Example Request:
{
"directive": {
"header": {
"namespace": "Alexa.PowerLevelController",
"name": "AdjustPowerLevel",
"messageId": "da81f4fb-c916-4bd4-9eb3-fe35ba6bae2a",
"correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "some-access-token"
},
"endpointId": "appliance-001",
"cookie": {}
},
"payload": {
"powerLevelDelta": 3
}
}
}
Payload details
| Field | Description | Type | Required |
|---|---|---|---|
| powerLevelDelta | The desired change in power level as percentage points. A positive or negative integer value used to increase or decrease the power level. For example, a starting value of 97 with a power level delta of 3 would increase the power level value to 100 | Integer from -100 to 100, inclusive. | Yes |
Properties and Events
For this interface, you must either reply:
- Synchronously, which means you send a Response event to Alexa from the Lambda function.
- Asynchronously, which means you send a Response event to the Alexa event gateway. When you reply asynchronously, you must include a
scopewith an authorization token to identify the customer, and a correlation token to identify the directive you are responding to.
When you send a Response, you should include the state of reportable properties in the context of the message.
Reportable Properties
| Property Name | Type | Description |
|---|---|---|
| powerLevel | Percentage | The power level of an appliance such as a power dimmer expressed as a percentage value between 0 and 100. |
Response
Send an Response event when a SetPowerLevel or AdjustPowerLevel request successfully completes.
Example Response
{
"context":{
"properties":[
{
"namespace":"Alexa.PowerLevelController",
"name":"powerLevel",
"value": 42,
"timeOfSample":"2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
}
]
},
"event":{
"header":{
"namespace":"Alexa",
"name":"Response",
"messageId":"30d2cd1a-ce4f-4542-aa5e-04bd0a6492d5",
"correlationToken":"dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==",
"payloadVersion":"3"
},
"endpoint":{
"scope":{
"type":"BearerToken",
"token":"Alexa-access-token"
},
"endpointId":"appliance-001"
},
"payload":{ }
}
}
ErrorResponse
You should reply with an error if you cannot complete the customer request for some reason. See Error.Response for more details.
Additional Sample Code
See the sample request and response messages in the Alexa smart home GitHub repo:
Related Interfaces
| Interface | Description |
|---|---|
| Alexa.PowerController | Defines messages to turn an endpoint on and off. |