alexa-samples / alexa-smarthome Goto Github PK
View Code? Open in Web Editor NEWResources for Alexa Smart Home developers.
Home Page: https://alexa.design/smarthome
License: Other
Resources for Alexa Smart Home developers.
Home Page: https://alexa.design/smarthome
License: Other
Differently from what stated in the semple_messages:
https://github.com/alexa/alexa-smarthome/blob/master/sample_messages/Authorization/Authorization.AcceptGrant.request.json
correlation_token is not included in the real requests
The scene activates no problem, I but the response I give back which matches the example, it doesn't like is the example out of date?
{
"context": {
"properties": [
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2017-10-24T17:44:26.519Z",
"uncertaintyInMilliseconds": 200
}
]
},
"event": {
"header": {
"namespace": "Alexa.SceneController",
"name": "ActivationStarted",
"payloadVersion": "3",
"messageId": "7f5179bd-3e3f-4a04-8455-018b71216fdc-R",
"correlationToken": "XXX=="
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "XXXMtSSVwoZhJhy7_7G6p"
},
"endpointId": "MwjLhmGjmgoLWSe4a"
}
},
"payload": {
"cause": {
"type": "VOICE_INTERACTION"
},
"timestamp": "2017-10-24T17:44:26.519Z"
}
}
It matches the sample online
@briankel - is there any documentation on what the "scope" field under configuration tab ?
I am trying to follow the steps under "Build a Working Smart Home Skill in 15 Minutes"
https://developer.amazon.com/docs/device-apis/alexa-discovery.html#capability-object
Documentation states these values are not mandatory, but the validation schema marks them as required.
The following Discover.Response is sent however, the device is not appearing in the Alexa Devices list. The json has been validated by following the instructions: https://github.com/alexa/alexa-smarthome/wiki/Validation-Schemas
Request:
{
"directive": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover",
"payloadVersion": "3",
"messageId": "7b6207b9-fdd8-4e0f-91c2-cd64ec5204db"
},
"payload": {
"scope": {
"type": "BearerToken",
"token": "redacted"
}
}
}
}
Response:
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"payloadVersion": "3",
"messageId": "7b6207b9-fdd8-4e0f-91c2-cd64ec5204db"
},
"payload": {
"endpoints": [
{
"endpointId": "hikbd321d7d4",
"manufacturerName": "momentum",
"friendlyName": "Staging",
"description": "something",
"displayCategories": [
"CAMERA"
],
"cookie": {
"model": "MOCAM-720-01",
"manufacturer": "momentum"
},
"capabilities": [
{
"type": "AlexaInterface",
"interface": "Alexa",
"version": "3"
},
{
"type": "AlexaInterface",
"interface": "Alexa.CameraStreamController",
"version": "3",
"cameraStreamConfigurations": [
{
"protocols": [
"RTSP"
],
"resolutions": [
{
"width": 1920,
"height": 1080
},
{
"width": 1280,
"height": 720
}
],
"authorizationTypes": [
"NONE"
],
"videoCodecs": [
"H264"
],
"audioCodecs": [
"AAC"
]
}
]
},
{
"type": "AlexaInterface",
"interface": "Alexa.PowerController",
"version": "3",
"properties": {
"supported": [
{
"name": "powerState"
}
],
"proactivelyReported": true,
"retrievable": true
}
},
{
"type": "AlexaInterface",
"interface": "Alexa.EndpointHealth",
"version": "3",
"properties": {
"supported": [
{
"name": "connectivity"
}
],
"proactivelyReported": true,
"retrievable": true
}
}
]
}
]
}
}
}
Hi
I can sucessfully call my smart home skill by saying
Alexa switch input to Satellite
Lambda receives the directive as
{
"directive": {
"header": {
"namespace": "Alexa.InputController",
"name": "SelectInput",
"payloadVersion": "3",
"messageId": "53c9ac3f-d20e-4506-86b3-39ea422633d4",
"correlationToken": "AAAAAAAAAACsqwiAPGRxeyZdhqLHHAfycAEAAAAAAABbsx0W67868BLmmNZ2/e8lXZlF5aGPno+dc7Em6/E3s/HVmWXRVPq4cFARu8F2lqj6C0esvl/1WxSxl5vBMEoG5zmwy8hRyfcrBg8JI3n28ckJPKMt3Y5EAJiIXs8sGMK43z1OkgAgtE20fAs6jL/TVKL5bsw7Vt/hk1cMNXE8pYknxWPBDXqFzX1HzjdD43CWP+g20vc+4TkHFq6Q8f0p2EvXrlQFJEmFXh+yQmXCya16AUbWCLfvCnApzEL0M1iwMIUY+vBOO4MB5mUmGOdZbnfe38nD23pPyD6LDOzkrGOeRvcg6W/v6kwYG9XBm4w8eWU8M8YxlvR+ztNFWk8Igvu+3jcAxwvbsnIz2YN00jVy5XcAE+Z0z6NP9j4QdIHhTHzRI0sSg03ClQoCsSYTdBZr8+x0250mX9SCgTQ/UstCKHK/C/CBRhlGhyjtdGvIS+xgr6srqF8W8go+Gjp5yNNjRP+CVad66I2pmzuoOg=="
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "Atza|IwEBIDVP74C8LqSZeP0g-MTGT-a5Qs3UHT50iQ64w4jQ8M9j1ZykTxVYyGRP3rtupeVMI5O_DG8KLLMAQUuwAI3gFpmca_ZEWZXyXSq_mXA6WeNahQe_t8kdTY0maeYCAjS98nAUJKlsBFbWNl7wOH3i8_GB0H8b7HBKOiOmwdS2GGH5owRvKe0gvoLcqulZfaBRQQQPwFYqJILON48fcza64jyDlai60KY0GT3GsHZ6QtzhkiXfFnSGz6aTI2TGjuUf87jJRt7sMshv4YB_TTC2KsV8_CisNEgOw9HGGgyXep8r_1MRpcL87QM2MB3_6Ll0dqxILRbiNsG5crhtn9mfqkUA8k3z0TzTqElsbFoRSG4S1rmkj_eihdXR5pabko0o72Lp2fBz2JRfN2BjHPp36I0C5byWtHE0gf9Pm298pQmIW2E0l_9jqJV2MV6NA1J92XnM5WDnWursjeA6ARUaGeKWWYdesz9NSnCMPznGGvbIvEkfaHV1TUfLPZuLLfT3kHU"
},
"endpointId": "appliance-001",
"cookie": {
"extraDetail3": "but they should only be used for reference purposes",
"extraDetail4": "This is not a suitable place to maintain current device state",
"extraDetail1": "optionalDetailForSkillAdapterToReferenceThisDevice",
"extraDetail2": "There can be multiple entries"
}
},
"payload": {
"input": "SATELLITE"
}
}
}
I send back the following but Alexa says 'Hmm this device is not responding'
{
"context": {
"properties": [
{
"namespace": "Alexa.InputController",
"name": "SelectInput",
"value": "SATELLITE",
"timeOfSample": "2017-11-27T15:11:42.574Z",
"uncertaintyInMilliseconds": 50
}
]
},
"event": {
"header": {
"namespace": "Alexa.InputController",
"name": "Alexa.Response",
"payloadVersion": "3",
"messageId": "53c9ac3f-d20e-4506-86b3-39ea422633d4-R",
"correlationToken": "AAAAAAAAAACsqwiAPGRxeyZdhqLHHAfycAEAAAAAAABbsx0W67868BLmmNZ2/e8lXZlF5aGPno+dc7Em6/E3s/HVmWXRVPq4cFARu8F2lqj6C0esvl/1WxSxl5vBMEoG5zmwy8hRyfcrBg8JI3n28ckJPKMt3Y5EAJiIXs8sGMK43z1OkgAgtE20fAs6jL/TVKL5bsw7Vt/hk1cMNXE8pYknxWPBDXqFzX1HzjdD43CWP+g20vc+4TkHFq6Q8f0p2EvXrlQFJEmFXh+yQmXCya16AUbWCLfvCnApzEL0M1iwMIUY+vBOO4MB5mUmGOdZbnfe38nD23pPyD6LDOzkrGOeRvcg6W/v6kwYG9XBm4w8eWU8M8YxlvR+ztNFWk8Igvu+3jcAxwvbsnIz2YN00jVy5XcAE+Z0z6NP9j4QdIHhTHzRI0sSg03ClQoCsSYTdBZr8+x0250mX9SCgTQ/UstCKHK/C/CBRhlGhyjtdGvIS+xgr6srqF8W8go+Gjp5yNNjRP+CVad66I2pmzuoOg=="
}
},
"endpoint": {
"endpointId": "appliance-001"
},
"payload": {}
}
Can anyone see anything wrong with my response?
When running through the docs on the Sample Backend, we see "KeyError:'friendlyName'" at step 6.2.2. After looking into things a bit more, it seems that changes have been pushed to api_handler_endpoint.py have changed the requirements for the POST body (835e2a7#diff-a009b70fe12e911579b4ff26ef10fb10L194).
This also looks like it impacts the sample_backend.postman_collection.json.
If this is not the cause of the error, what are the steps toward remediation? If this is the cause of the error, can we update the documentation?
Also related to: https://forums.developer.amazon.com/questions/112881/why-getting-keyerrorfriendlyname.html
Dear all,
Im working on https://github.com/alexa/alexa-smarthome/wiki/Validation-Schemas with Ajv validator,
Here is my code:
'use strict'
const Ajv = require('ajv')
const draft04 = require('ajv/lib/refs/json-schema-draft-04.json')
const ajv = new Ajv()
ajv.addMetaSchema(draft04)
let schema = require('./alexa_smart_home_message_schema.json')
const ajvValidate = ajv.compile(schema)
module.exports = function (data) {
const ok = ajvValidate(data)
if (!ok) { console.log(ajvValidate.errors) }
return ok
}
Then in runtime, value of data is :
{
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"payloadVersion": "3",
"messageId": "c7d01e45-394b-4f7f-9ea6-cb527f3d390d",
"correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg=="
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "access-token-from-skill"
},
"endpointId": "58b8d2e3bfa8891000fe7ab8",
"cookie": {}
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.ThermostatController",
"name": "thermostatMode",
"value": "COOL",
"timeOfSample": "2018-02-27T03:19:52.031Z",
"uncertaintyInMilliseconds": 500
}
]
}
}
I checked on JSON SChema Lint with alexa_smart_home_message_schema.json and this passed.
But in runtime, i got an error :
[
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.EndpointHealth"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerLevelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PercentageController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.BrightnessController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorTemperatureController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.LockController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].name",
"schemaPath": "#/properties/name/enum",
"params": {
"allowedValues": [
"targetSetpoint",
"lowerSetpoint",
"upperSetpoint"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "type",
"dataPath": ".context.properties[0].timeOfSample",
"schemaPath": "#/definitions/common.properties/timestamp/type",
"params": {
"type": "string"
},
"message": "should be string"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.TemperatureSensor"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ChannelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.InputController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "anyOf",
"dataPath": ".context.properties[0]",
"schemaPath": "#/items/anyOf",
"params": {},
"message": "should match some schema in anyOf"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.EndpointHealth"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerLevelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PercentageController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.BrightnessController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorTemperatureController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.LockController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].name",
"schemaPath": "#/properties/name/enum",
"params": {
"allowedValues": [
"targetSetpoint",
"lowerSetpoint",
"upperSetpoint"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "type",
"dataPath": ".context.properties[0].timeOfSample",
"schemaPath": "#/definitions/common.properties/timestamp/type",
"params": {
"type": "string"
},
"message": "should be string"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.TemperatureSensor"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ChannelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.InputController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "anyOf",
"dataPath": ".context.properties[0]",
"schemaPath": "#/items/anyOf",
"params": {},
"message": "should match some schema in anyOf"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.EndpointHealth"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerLevelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PercentageController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.BrightnessController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorTemperatureController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.LockController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].name",
"schemaPath": "#/properties/name/enum",
"params": {
"allowedValues": [
"targetSetpoint",
"lowerSetpoint",
"upperSetpoint"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "type",
"dataPath": ".context.properties[0].timeOfSample",
"schemaPath": "#/definitions/common.properties/timestamp/type",
"params": {
"type": "string"
},
"message": "should be string"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.TemperatureSensor"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ChannelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.InputController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "anyOf",
"dataPath": ".context.properties[0]",
"schemaPath": "#/items/anyOf",
"params": {},
"message": "should match some schema in anyOf"
},
{
"keyword": "oneOf",
"dataPath": "",
"schemaPath": "#/oneOf/1/oneOf",
"params": {},
"message": "should match exactly one schema in oneOf"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.EndpointHealth"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PowerLevelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.PercentageController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.BrightnessController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ColorTemperatureController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.LockController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].name",
"schemaPath": "#/properties/name/enum",
"params": {
"allowedValues": [
"targetSetpoint",
"lowerSetpoint",
"upperSetpoint"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "type",
"dataPath": ".context.properties[0].timeOfSample",
"schemaPath": "#/definitions/common.properties/timestamp/type",
"params": {
"type": "string"
},
"message": "should be string"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.TemperatureSensor"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.ChannelController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.InputController"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "enum",
"dataPath": ".context.properties[0].namespace",
"schemaPath": "#/properties/namespace/enum",
"params": {
"allowedValues": [
"Alexa.Speaker"
]
},
"message": "should be equal to one of the allowed values"
},
{
"keyword": "anyOf",
"dataPath": ".context.properties[0]",
"schemaPath": "#/items/anyOf",
"params": {},
"message": "should match some schema in anyOf"
},
{
"keyword": "additionalProperties",
"dataPath": "",
"schemaPath": "#/oneOf/3/additionalProperties",
"params": {
"additionalProperty": "context"
},
"message": "should NOT have additional properties"
},
{
"keyword": "additionalProperties",
"dataPath": "",
"schemaPath": "#/oneOf/4/additionalProperties",
"params": {
"additionalProperty": "context"
},
"message": "should NOT have additional properties"
},
{
"keyword": "oneOf",
"dataPath": "",
"schemaPath": "#/oneOf",
"params": {},
"message": "should match exactly one schema in oneOf"
}
]
somebody Help me ? , thanks a lot.
I just wanted to check if the device is online or not before power controller if the device is offline, I will response an offline error.
But Alexa always response "xxx is not responding", it's driving me crazy.
below is my error response format:
Hi Jenn, my error response is formatted as below, but Alexa aways responses "xxx is not responding", can you help to confirm the right format?
Any help is great.
My error response format is as below:
{
"event": {
"header": {
"payloadVersion": "3",
"correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg==",
"namespace": "Alexa",
"name": "ErrorResponse",
"messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
},
"endpoint": {
"endpointId": "AC000W001509569"
},
"payload": {
"message": "device is offline, you can not control it now.",
"type": "ENDPOINT_UNREACHABLE"
}
}
}
I changed the "proactivelyReported" to be ture, and "retrievable" to be false. Alexa app was always show "There was a problem". If I changed "retrievable" to be ture, it disappeared and everything seems OK.
1.Is the "retrievable" must be true?
2. when responsing the command like "Alexa.PowerController" synchronously, is it required the "endpoint" paramter with scope?
This following JSON is the example of ChangeReport when discovery and the status of device changed. The report response is 202 code and I validated that the message was OK according to the “validation_schemas” document. It seemed that the report status did not work.
{
"context": {
"properties": []
},
"event": {
"header": {
"messageId": "8UJjVopqgIrISeCGDx82QOF3Vcvnmcjf",
"namespace": "Alexa",
"name": "ChangeReport",
"payloadVersion": "3"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "Atza|IwEBIP32iJfp0uy2owLwbgTxbPi3y2cpSz23rJUFbdkoppuZDXx7aD2natjo06n60jYcRU1VyUPLU31l8rVQUJHocusEqortO9pS2mildZ9X0yBi2T01QzXeNWiWOFxZFp86WZziLYzbVxDQxZb0y05Zvb6qVGUTuTmDC3OGBKds0ZJMqxe2YfUeFO41WZSRpe6GvHLDBUl-nUX6QsKAyEW-dZs0zh9hkESRJRXUtu9sl9QfyYt-5CDbelbn7Na5wCUEbfFtWLGwhRyURgGYP9Np7ThBbCBecicBCyu3gfCOml31Ygb6c-t8YsKUWLcjHTLBauz-dcnTMC-whhraEv3faMRc_-s7PbhbAnvbpCDXojbiEA"
},
"endpointId": "my device id"
},
"payload": {
"change": {
"cause": {
"type": "PERIODIC_POLL"
},
"properties": [
{
"namespace": "Alexa.PowerController",
"name": "powerState",
"value": "ON",
"timeOfSample": "2017-12-29T09:26:23.7Z",
"uncertaintyInMilliseconds": 7
},
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "2017-12-29T09:26:23.7Z",
"uncertaintyInMilliseconds": 7
}
]
}
}
}
}
Hi -
My skill discovers and controls thermostats + temp sensors. In v2, users could ask "What's the temperature of device name" - and it would work.
In v3, the only command that seems to respond is "What temperature is device name set to?" - which isn't very natural, and is asking the wrong thing - i want the current temp, not the temperature i've asked it to heat to.
Can someone comment on this? There's quite a few of us on the Smart Home Skill forum struggling with this
Now that the Forget All button was removed in the smart home list, what is the discovery response to delete/remove a device that doesn't exist anymore? Right now if the discovery response does not include the endpoint this one become offline but is still there, and the user can't remove it, not event disable the skill
The validation schema found in this repo is not valid for cooking appliances described in the API documentation. Please update the schema to reflect these new categories.
i.e. the example discovery response for a MICROWAVE device is invalid.
Furthermore, the documentation is completely inconsistent on this topic, e.g.
this documentation page lists supportedCookingModes whereas
the link above lists the same field as cookingModes
Is there any place more appropriate to list these mistakes, as there are quite a few in the documentation that should really be updated.
Hi AlexaTeam,
i have done build a Working Smart Home Skill in 15 Minutes all of these steps. but i can't find any virtual devices - Go to Smart Home > Devices and you should see several virtual devices. and when i said "Alexa, turn on switch", the alexa respone me "Sorry, i didn't find switch" Did i miss anyting? what should i do?
My skill is working fine for powerController, sceneController etc..
But with channelController i am facing problem, It's very irritating there is no clear message where it's failing,.
I checked my lambda for logs i find everything right even channel is changed(Action happening as expected) but alexa says 'my device name' is not responding.
This is what i get in payload from alexa directive -
{
"header": {
"namespace": "Alexa.ChannelController",
"name": "ChangeChannel",
"payloadVersion": "3",
"messageId": "SOMEID",
"correlationToken": "SOME_TOKEN"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "SomeBearerToken"
},
"endpointId": "5a27c092914b9b7dee318fc7",
"cookie": {
"kd_id": "6001941a6601",
"type": "irApp"
}
},
"payload": {
"channel": {
"number": "201"
},
"channelMetadata": {}
}
}
And this is what i am sending in response after successful action
{
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"payloadVersion": "3",
"messageId": "SOMEID",
"correlationToken": "SOME_TOKEN"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "SomeBearerToken"
},
"endpointId": "5a27c092914b9b7dee318fc7",
"cookie": {
"remote_codeset": "58c630053c8ab2bc3d3b0284",
"paired_ud": "5a5711de57a58c0a06c3e432",
"kd_id": "6001941a6601",
"type": "irApp"
}
},
"payload": {}
},
"context": {
"properties": [
{
"namespace": "Alexa.ChannelController",
"name": "channel",
"value": {
"number": "201",
"callSign": "callsign1",
"affiliateCallSign": "callsign2"
},
"timeOfSample": "2017-02-03T16:20:50.52Z",
"uncertaintyInMilliseconds": 0
},
{
"namespace": "Alexa.EndpointHealth",
"name": "connectivity",
"value": {
"value": "OK"
},
"timeOfSample": "Thu Mar 01 2018 17:53:01 GMT+0530 (IST)",
"uncertaintyInMilliseconds": 200
}
]
}
}
My server responds to alexa within 200-300ms still alexa tells the 'my device' is not responding.
I am stuck at this thing for 3 days.. Is there something wrong with the response of channelController responseformat.. ?
Hi,
I have posted my issue in forum. Following is the link of it:
I am getting problem with discovery response. Discovery command hit Lambda function. But Alexa is not detecting any smart home devices. I have check the response of Lambda function with JSON Schema Lint, it is not showing any error. I am deploying Lambda in JAVA8.
Please help me, I am stuck here.
After a while virtual device offline。
Test normal, will not work for a while
The discovery of devices (sample black switch) is now working after the sample postman collection is fixed [reference]. The next problem is that Alexa can't set the state of the switch - always return "sample black switch is not responding".
The problem seems to be in api_handler_directive.py
...
alexa_power_controller_response = AlexaResponse(
namespace='Alexa.PowerController',
name=name,
token=token,
correlation_token=correlation_token,
endpoint_id=endpoint_id)
...
that namespace and name should not be included there.
I tried this:
alexa_power_controller_response = AlexaResponse(
token=token,
correlation_token=correlation_token,
endpoint_id=endpoint_id)
alexa_power_controller_response.add_property()
alexa_power_controller_response.add_property(
namespace='Alexa.PowerController',
name='powerState',
value=power_state_value)
It seems working. Can you confirm it is the right fix?
I want to add new modes like "DRY" and "TURBO" to existing modes like ,"AUTO","COOL" and ,etc .
Can you please suggest me that .
Hi, could someone please share discovery sample for ColorController device, I cannot find it in the documentation.
Thanks!
Hello,
I'm developing a smarthome with v3 api, and got error when try to control a large group. Steps to observe error below.
Step 1: I make a program to control individual device, worked well. I make a group of ~10 devices, worked well.
Step 2: Then make a group of 49 devices, the error "I am not quite sure what went wrong" appear.
Logging show that I don't have enough request, about 29 turnOff request for group of 49 devices.
Step 3: I make a fast response for turnOff request, return success response immediately.
Logging show that the interval between the first and the last request is about 6 seconds. (see log bellow)
Question: What make interval between first request and last request in group control is so large (up to 6 seconds in step 3, and > 10 seconds in step 2). How could I eliminate the "I am not quite sure what went wrong" error.
Environment:
Thanks a lot in advanced.
Hi,
when I respond to your service with answer below, Alexa says "Device is not responding". I have double checked my response with your documentation and it seems to be structured correctly. Please help.
{
"context": {
"properties": [
{
"namespace": "Alexa.ThermostatController",
"name": "targetSetpoint",
"value": {
"value": 21,
"scale": "CELSIUS"
},
"timeOfSample": "2018-01-19T15:50:39.070Z",
"uncertaintyInMilliseconds": 500
},
{
"namespace": "Alexa.ThermostaController",
"name": "thermostatMode",
"value": "AUTO",
"timeOfSample": "2018-01-19T15:50:39.070Z",
"uncertaintyInMilliseconds": 500
}
]
},
"event": {
"header": {
"namespace": "Alexa",
"name": "Response",
"payloadVersion": "3",
"messageId": "...",
"correlationToken": "..."
},
"endpoint": {
"endpointId": "..."
},
"payload": {}
}
}
Hi,
I am integrating smart home skill for my thermostat, Smart home skill support COOL, HEAT, AUTO, OFF mode of my thermostat but I have two additional mode names "Fan Only" and "Emergency heat". By researching, I found there is a way to define CUSTOM mode by which I can handle user-defined custom mode.
How can I register my custom "fan only" and "Emergency heat" mode? Do I need to tell Amazon or Is there any configuration in skill or lambda? Please help.
Thanks in advance!
I'm working my way through the guide here: https://github.com/alexa/alexa-smarthome/wiki/Build-a-Working-Smart-Home-Skill-in-15-Minutes
I have everything set up, and when I ask Alexa to discover devices, all I get is an error in the logs:
Unable to import module 'lambda': cannot import name 'validate'
If I change the Python version to 2.7 then it can't even find the module jsonschema. Is there some other thing that I'm doing wrong? I can provide plenty of extra details, but really, I just went step by step through that guide, and it's just not working, although I have everything connected, and was able to enable the skill from the Alexa app on my phone. (Also can do it through the web interface from my PC, but either way seems the same result. Python can't find that method for some reason.)
Thanks!
As of 1/2/2018, there are still quite a few examples in the documentation that refer to the old V2 message format, which isn't supported anymore.
Also, if the developer follows the instructions "On the Select blueprint page, type home in the filter box. Select the alexa-smart-home-skill-adapter." (found here https://developer.amazon.com/docs/smarthome/steps-to-build-a-smart-home-skill.html), the blueprint will use V2 and therefore will be incompatible with the smart home skill that uses V3.
Sure, the examples here are up-to-date, but they are for Python, but the documentation uses Node.js code.
This is quite annoying. It would be great if Amazon could assign someone to go through all of the documentation, examples, and templates, and bring them up to date to V3. Thanks!
It looks like the .ConnectedHome is no longer in the namespace.
Hi
I've been following the 15 minute tutorial at https://github.com/alexa/alexa-smarthome/wiki/Build-a-Working-Smart-Home-Skill-in-15-Minutes, and am hitting an error at the linking stage.
So far, I've
It's then going wrong when I try to enable the skill. I go to https://alexa.amazon.com and can find the skill under Your Skills with the devUS tag. I then get a "click 'Allow ' to sign in to..." dialog, and when I click allow I get "an error occurred while attempting to link Alexa to xxx - please try again later". I've tried this several times at different times with same result.
Any clue? Nothing is showing up in the lambda logs, not that I'd expect it to.
thanks
Calum
This had worked for the last 2 months and was used for a published skill. A couple of days ago I tried to discover devices and it didn't work anymore and it turns out the behaviour of something has changed. My skill uses the linked account identity to determine what devices the user can discover/control. This is done by storing the CognitoID of the linked account and the id of each device in a database. Here is the code that previously worked.
def lambda_handler(request, context):
access_token = request["directive"]["payload"]["scope"]["token"]
response = boto3.client("cognito-identity", "us-east-2").get_id(
AccountId="xxxxxxxxxxxx",
IdentityPoolId="us-east-2:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
Logins={
"www.amazon.com": access_token
}
)
When I check the logs I see that the cognito id returned by each new discovery request results in a unique cognito id. Before it returned the cognito id of the linked user account.
EDIT:
Ok it turns out these are unsolicited discovery requests (about 60 a day) and each one has a unique user id. Using the token info REST api endpoint, the users are definitely not linked accounts. I don't know where they're coming from but it pollutes my cognito identity store with all these bogus identities. If only cognito had an option to retrieve and not generate identities.
Loved the simple 15 minute wiki format.
I was surprised to see a bunch of code in https://github.com/alexa/alexa-smarthome/blob/master/sample_lambda/python/lambda.py trying to support both v2 and v3.
Correct me if I'm wrong, but this is targeted at new skill creation where you would only need to support v3, right? If so, I would suggest significantly simplifying the code to support only v3. Or am I missing something?
Given that I am only an intermediate programmer as my background has been more hardware based over the years, I have never seen anything as poorly managed as the Alexa project when it comes to Amazon changing the interface.
I followed the instructions, took notes and believed I was understanding how this all fits together only to hit a roadblock as when getting to the last steps, I get an error telling me that I need to have the Alexa Skills Kit (not Alexa Smart Home) as a trigger for my Lambda function.
Seriously, I have spent the best part of a week trying to get a simple test to work by trying various samples I can find and all have ended in frustration. From 2 month old youtube videos being out dated because yet again Amazon has changed something to their own sample files which should be copy and paste always seem to have an issue when it comes to actually using an echo with a registered account.
Can you verify this project and update if needed? For now I am going to go over to google and get my project working with them. If I can't get this solved, I guess Amazon will be left in the dust as I build my hardware platforms to work with the competition instead.
There isn't much documentation on how to use the InputController interface. From what I gather it has support for a limited set of built-in names. However, the supported names are not documented anywhere.
Besides that, I think a more common case for modern devices is for user customizable input names. Instead of "HDMI 1", users almost certainly refer to it by the actual source device name. Any decent smart home system allows naming these inputs for user clarification. All user interfaces would show the device input source name so the user knows what they're doing. Controlling with Alexa should be the same.
Ideally InputController should be able to have a list of supported source names which can be used.
Here is a forum discussion on this:
https://forums.developer.amazon.com/questions/79376/inputselect-slot-type.html
We're having issues with proactive reporting (if we turn off retrievable, and send an proactive report the amazon app indicates that an error occured).
So, I guess the first question would be, is the property called "proactivelyReported", as most docs indicate, or "proactivelyReportable", as stated in the v3 migration guide here: https://developer.amazon.com/de/docs/smarthome/smart-home-skill-migration-guide.htm
though it's almost a moot point, neither seems to work for us.
any hints as to how to debug issues with proactive reporting? the server response is 201, seemingly there is no error. the json we send looks fine.
https://developer.amazon.com/docs/device-apis/alexa-discovery.html#endpoint-object
for the discovery response, endpoint.cookie
is said to be a Map of string/value pairs
however schema validate only string/string pairs.
Please update the documentation or the schema.
I was tempted to use deeper dictionary or/and other values
like boolean/objects/integer
I installed Alexa in the raspberry pi.
I want to control the LED on the Raspberry pi using the AWS Lambda. It seems that YouTube only uses flask-ask.
I want to control the LED on the raspberry pi with the Lambda Function.
I want you to tell me how.
Spent the better part of an afternoon banging my head against this one until I realized that PlaybackController
is simply not included in the Validation Schema!!
Is this intentional? If I was to write the code to validate it, would you look at a PR?
I am planning to direct the user to a login page that I provide in companion app when the user tries to enable a smart home skill.So how can I handle such kind of authentication.? Is there any tutorial available that does not involve LWA authentication.?
Could you please tell me what are the changes that I should do to try out this skill in India.
To be precise, will i be able to use the same code in case of SkillLambda and EndpointLambda (the ones in the S3Bucket: endpoint-code-us)
Json is right in the Validation Schema.
However, echo does not have any translation.
很费解,你们为什么没有更多的log提示
Spent good several hours scratching my head and getting annoyed at "cant find any devices", untill trial and error gave that one out.
StepSpeaker is not included in alexa_smart_home_message_schema.json
This cause discovery requests to fail validation.
Hello,
I have followed the instructions provided on your wiki to build Smart Home Skill in 15 minutes. I was able to complete the process without any issues until configure skills section.
But when I went over test instructions. Smart Home Devices didn't recognise any virtual device.
When I say "Alexa, turn on switch" -> It responds back saying "Sorry, I didn't find switch"
If you follow the 'Build a Working Smart Home Skill in 15 Minutes' and your skill isn't triggered.. read the page again and make sure you have everything as is on the page. Don't take shortcuts!
Now, if it is still not working.. Make sure that, when you are creating a skill in the "English (US)" language, your lambda is created in the region "US East (N. Virginia)". This is described as "You must provide geographic-specific endpoints." in the documentation. For a non-native English speaker you quickly read over this part and i think it is not mentioned on the tutorial above. It would help if that is made more clearly.
Here is the reference from the documentation:
Skill language | Endpoint Region | Lambda Function Region |
---|---|---|
English (US), English (Canada) | North America | US East (N. Virginia) |
English (UK), German | Europe | EU (Ireland) |
English (India) | India | EU (Ireland) |
Japanese, English (Australia) | Far East | US West (Oregon) |
The issue i am having is.. Can this maybe be made more clearly in the documentation?
As discussed on AWS Forums, the python 3.6 runtime used here, uses OpenSSL 1.0.0-fips, which doesn't support TLS 1.2 which is necessary in order to connect with AWS IoT.
This affects the usefulness of the sample because after successfully running the lambda sample, developers expect to be able to extend it to support loading endpoints dynamically according to their own design. ie. With DynamoDB and IoT, users and things are associated, and the lambda function will determine what things the Alexa authorized user has access to and display them. That is the next logical implementation step, but this issue blocks that.
I have a pair of motorized curtains that run with commands Open,Close and Stop but there seems to be no matching skill to expose them to alexa. Right now I have no other option than to use TurnOn and TurnOff combined with Stop from playback... but its a bit weird to turn off curtains...
So Im wondering if there could be a way to extend the default skill protocol to support curtains too?
Hi!
First of all, thank you for your great work. I am having an issue with my Smart Home Skill responding with discovered devices. I receive the Discovery request in my Lambda function correctly but I am unable to get the Alexa Android App to recognize any discovered devices. I consulted the developer docs and tried to build a proper response to get some demo devices up and runnung but the Alexa Android App always shows "No new devices found". Then I tried returning the example response from:
https://github.com/alexa/alexa-smarthome/blob/master/sample_messages/Discovery/Discovery.response.json
I just return the whole thing as a string in my custom .net Lambda function (not using the python example). After the discovery times out in the app I get greeted with the "No new devices found" screen. I guess I am doing something wrong because I doubt that the example response from this repository really is not correct.
In the logs of my Lambda function I can see that the Discovery request is received twice. The first call runs for about 900ms and the second one runs approximately 60ms.
Can someone get me on the right track for solving this problem? I am sorry if I left out any relevant information.
I have created Alexa smart home skill using tutorial https://github.com/alexa/alexa-smarthome/wiki/Build-a-Working-Smart-Home-Skill-in-15-Minutes.
Language of the skill: English (India)
Lambda function location: EU Ireland region.
Language of lambda function: Python 3.6
Lambda functions executes properly for below test case
{
"directive": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover",
"payloadVersion": "3",
"messageId": "1bd5d003-31b9-476f-ad03-71d471922820"
},
"payload": {
"scope": {
"type": "BearerToken",
"token": "access-token-from-skill"
}
}
}
}
When I login to Alexa at (alexa.amazon.in) and navigate to "Skills", I get error "The language you selected does not match your Amazon account settings. As a result, Alexa skills are not available. To get the best Alexa experience, please choose English (India) by selecting continue".
But there is not option on settings page to select the language.
I did see my skill once on first time login but it resulted in an error "An error occurred while attempting to link Alexa".
Also, in both cases, there are no logs on CloudWatch.
I am stuck with this one. Any clues?
Regards,
Vishal Kothari
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.