question

newuser-6f7d8630-0d3a-4289-a17b-bf56e735c030 avatar image

SmartHome Skill v3 - schema not valid

Hi,

I've tried to create a new smarthome skill (using v3) controlling just PowerControl devices.

The skill seems to work, the lambda function is called (CloudWatch shows a log). However, no matter what I do Alexa does not find any devices. Looking for a solution, I've searched in this forum for a solution, pointing me to a post telling me to validate the response against the SmartHome API JSON schema (alexa_smart_home_message_schema.json).

Unfortunately, the validator really shows errors:

.event.header.namespace should be equal to one of the allowed values "Alexa.Discovery"
.event.header.name should be equal to one of the allowed values "Discover.Response"

Well, the response I am validating is the following:

{
  "event": {
    "header": {
      "namespace": "Alexa.Discovery",
      "name": "Discover.Response",
      "payloadVersion": "3",
      "messageId": "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4"
    },
    "payload": [
      {
        "endpointId": "HM_335F8A",
        "displayCategories": [
          "SWITCH"
        ],
        "manufacturerName": "FHEM",
        "cookie": {
          "room": "autocreate"
        },
        "capabilities": [
          {
            "type": "AlexaInterface",
            "interface": "Alexa",
            "version": "3"
          },
          {
            "interface": "Alexa.PowerController",
            "version": "3",
            "type": "AlexaInterface",
            "properties": {
              "supported": [
                {
                  "name": "powerState"
                }
              ],
              "retrievable": true
            }
          }
        ]
      }   ]
  }
}

As I could not get the header being validated correctly, I copied it from the docs. No matter what I do, the JSON response is not valid (and I guess that's the reason why Alexa does not find my returned devices).

The corresponding Cloud Watch log is "/aws/lambda/fhem2017/12/28/[$LATEST]b67e64e953f140fea3c691794462ca74" - maybe that helps.

Can you help me in resolving this issue?

Thanks,

Matthias

skillalexa smart home
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

newuser-6f7d8630-0d3a-4289-a17b-bf56e735c030 avatar image
newuser-6f7d8630-0d3a-4289-a17b-bf56e735c030 answered

Well I guess I found my error - the endpoints property is missing in between (strange error from the schema generator here). I guess it will work now, thanks anyways.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.