The Alexa skill does not work with "Increase/Decrease device_name to percentage".
Example : Me - Alexa, Increase device by 20%
Alexa - Sorry the device is not responding.
However, when I check in Alexa application it increases the brightness by 20%.
Request :
{
"directive": {
"header": {
"namespace": "Alexa.BrightnessController",
"name": "AdjustBrightness",
"payloadVersion": "3",
"messageId": "0d-4605-9d50",
"correlationToken": ""
},
"endpointId": "device",
"cookie": {
"Load": "LOAD_1",
"NodeIndex": "0",
"Type": "LIGHT",
"Name": "96005E",
"Thing": "device_0001"
}
},
"payload": {
"brightnessDelta": 20
}
}
}
Response :
{
"context": {
"properties": [
{
"namespace": "Alexa.BrightnessController",
"name": "brightness",
"value": 71,
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 500
}
]
},
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"payloadVersion": "3",
"messageId": "48CE-BBE5",
"correlationToken": ""
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "access-token-from-Amazon"
},
"endpointId": "device"
},
"payload": {}
}
}
When I command to "Set device to 20%" it works fine, with "OK" response from Alexa.
Note : I have tried Alexa.PercentageController it still gave me the same error response.
So, I finally figured it out, all credit goes to the Amazon team. The problem was with the response which I was sending to Alexa. The response I was sending was async, but Alexa requires sync response.
This is what the Amazon team replied with:
https://developer.amazon.com/docs/device-apis/alexa-interface.html#response
Note: that a synchronous response does not include a bearer token, scope, etc.
If your intention is to follow the asynchronous response pattern then you first need to send a synchronous deferred response message and then follow up with an asynchronous response which you send to the Alexa event gateway.
Note: that most of our lighting partners do not use the deferred response pattern and instead just respond to the original control message with a synchronous message. You would typically only follow the deferred response pattern with a light in rare conditions where your backend architecture necessitates this flow.