alexa-samples / alexa-smarthome

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

Alexa discovery with empty additional attributes not working in smart home skill #145

Closed satheshshiva closed 5 months ago

satheshshiva commented 4 years ago

The alexa discovery service api says that the additionalAttributes for the discovery service and all the fields inside the object as not required (https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery.html#additionalattributes-object).

Sending empty value for any of these fields is breaking the discovery service and alexa is not able to find any device. Even if there is another device in the list without this attribute, alexa is not detecting any device which most probably means it is throwing an internal error.

Example, Alexa will detect the new device with the following, "additionalAttributes": { "model": "123" }

Alexa reports no new devices found with the following, "additionalAttributes": { "model": "" }

I lost 2 days in narrowing it down the issue. Please fix the issue or update the documentation to say empty values are not supported for the welfare of the next developer.

helviojr commented 4 years ago

I had another problem: one cannot use non-English characters, although any punctuation is allowed in all properties inside additionalAttributes, but the backslash. Not mentioned in documentation.

I'm working in a PR that already addresses your problem and mine:

        "model.AdditionalAttributes": {
            "type": "string",
            "pattern": "^[ -\[-~]*$",
            "minLength": 1,
            "maxLength": 256
        },
aszk commented 9 months ago

Do you still have the issue?

aszk commented 5 months ago

Closing due to inactivity.