alexa-samples / alexa-smarthome

Resources for Alexa Smart Home developers.
https://alexa.design/smarthome
Other
680 stars 336 forks source link

alexa_smart_home_message_schema.json fails to validate Amazon's own Discovery.Response example #141

Closed cloudon7281 closed 9 months ago

cloudon7281 commented 4 years ago

Hi

I'm trying to debug why discovery responses from my formerly-working smart skill are seemingly not being recognised (no new devices are being reported in the Alexa app). Manually comparing my JSON response to the docs it looks fine, but following the advice in https://github.com/alexa/alexa-smarthome/wiki/Validation-Schemas I tried to use https://www.jsonschemavalidator.net/ to validate my response, and it reported hundreds of errors, starting with the unpromising "Alexa.Discovery" is not defined in enum. So instead of my skill's discovery response I tried the response example at https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery.html#response - which found 70 errors.

I suspect I'm doing something stupid - surely the documented example discovery response should pass schema validation?

cloudon7281 commented 4 years ago

I've debugged my primary problem (my discovery responses were taking longer than the 8s timeout Alexa seemingly imposes; fixed by upping the memory allocated to my lambda, which in turn allocates more CPU) but the validation described by https://github.com/alexa/alexa-smarthome/wiki/Validation-Schemas seems broken. Specifically:

Suggest that either the schema validation is fixed or the documentation updated.

helviojr commented 4 years ago

I had a problem that took my weekend away, but finally found it: the entities' additional attributes cannot have non-English characters!! The documentation does not say that. I'm planning on create a PR to fix that verification, so Discovery json will fail test (instead of being silently ignored by Alexa).

Other problem I found is the lack of WakeOnLANController in schema. If you're using that controller, surely you'll get those "hundreds of errors" (when it does not find a suitable option, it just report error for each one of the possibilities unfufilled). I proposed PR #157 to solve this one.

@cloudon7281 , please, let me know if those two would solve your issue (Wake on LAN PR or accent letter in additionalAttributes), so I can send a PR to solve that last one also.

aszk commented 9 months ago

We've added WakeOnLANController. Closing.