alexa-samples / alexa-smarthome

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

Example device discovery response not working? #58

Open npag opened 6 years ago

npag commented 6 years ago

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.

meerifan89 commented 5 years ago

I don't know if you still have an issue with that or if you already solved the problem. Anyhow I thought I try to share my investigation... I had a similar problem. So I was using Python as the programming language in AWS Lambda, anyhow our backend is written in Elixir. I used this as a reference. What I observed was that when using the AlexaResponse everything worked fine, but with our backend I also could not find any devices during Alexa.Discovery. The problem with the Elixir response was that I was sending pure json back to Alexa, but AlexaResponse was sending a python object. Solution: json.loads(<json-from-elixir-backend) so maybe you have to find a similar solution. use the correct format and you are good to go. hope that helped ✌️

helviojr commented 4 years ago

I'm using node.js, and had no issue sending js object. But I discovered intenational characters for endpoint additional attributes was the issue. Tried for many days until find that. I'll send a PR to try to correct it. The documentation is not correct on that, also from friendlyName property, I discovered can have any character, including ASCII > 127.

helviojr commented 4 years ago

I'm testing another issue: some capability interfaces will not be accepted if your skill has only languaGes where it is not supported. For example, locale pt_BR does not support any interface but SecurityPanelController and LockController. It seems I solved that including en_US as second language for may skill. My Alexa account is still pt_BR and skill has support to both languages and devices with other capabilities are discovered.