alexa-samples / alexa-smarthome

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

Another Sample Backend Problem #51

Closed mingdee closed 6 years ago

mingdee commented 6 years ago

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?

ArthurAzrieli commented 6 years ago

I think I have the same problem

mikemaas-amazon commented 6 years ago

This should be addressed by PR #59 - respond to this issue if it doesn't fix it for you.