Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HA Cloud + Alexa: thermostat setting transactions are executed but error out at the end: "I am not quite sure what went wrong" #15580

Closed
arigit opened this issue Jul 20, 2018 · 2 comments · Fixed by #17969
Assignees

Comments

@arigit
Copy link
Contributor

arigit commented Jul 20, 2018

Home Assistant release with the issue:
Home Assistant 0.74.0

Last working Home Assistant release (if known):
N/A

Operating environment (Hass.io/Docker/Windows/etc.):

Raspbian

Component/platform:

https://www.home-assistant.io/components/cloud/

https://www.home-assistant.io/components/alexa/

Description of problem:
I opened an HA Cloud account and added the HA Alexa skill to my alexa account, and linked them.

I exposed the "switch" and "climate" domains to alexa. Alexa's discovery works perfectly.
I can see my thermostat and my switches.

Controlling my switches via voice works fine.

But when I ask alexa to set the temperature to any value via voice (Alexa set the thermostat to 24 degrees), I immediately get “I am not quite sure what went wrong”. However, the actual change in the thermostat is done, HA changes the setting as I asked Alexa to do. This is consistent: every single time I attempt, the change in the thermostat is done, but Alexa "errors out" sayng "I am not quite sure what went wrong".

Before HA Cloud + Alexa, I used the older HAASKA (with V2 payloads), on this same HA server and essentially the same configuation, and it worked perfectly, it never had this problem.

I first enabled HA Cloud with HA 0.73 and the problem was there. Now I updated to 0.74 and same issue.

I checked the logs in HA: no errors. See the debug logs below.

One observation - I notice HA's response to Alexa has an empty payload. There doesn't seem to be a "success" or 200/OK or any indication that the command was succesfull?

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

cloud:     
  alexa:          
    filter:
      include_domains:
        - switch
        - climate
      exclude_entities:
        - switch.wemo_insight

Traceback (if applicable):

HA logs for the  clould & ecobee components
(removed the tokens)

018-07-20 13:46:13 INFO (Thread-16) [homeassistant.components.ecobee] Ecobee data updated successfully
2018-07-20 13:46:34 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2018-07-20 13:46:37 INFO (MainThread) [homeassistant.components.cloud.iot] Connected
2018-07-20 13:46:56 DEBUG (MainThread) [homeassistant.components.cloud.iot] Received message:
{'handler': 'alexa',
 'msgid': '9c8f4a49-54fd-4f97-ad64-f02f158d9957',
 'payload': {'directive': {'endpoint': {'cookie': {},
                                        'endpointId': 'climate#thermostat',
                                        'scope': {'token': 'eyJraWQiOiJGTzR4d08xNUJzbDZVVF..........GehvBgbb1IU9_R2uakIfw7qZmg9BWqZgngWLbHchtAw',
                                                  'type': 'BearerToken'}},
                           'header': {'correlationToken': 'AAAAAAAAAAA7N53jmAaeh9qr.............KRzPMfdVIOMwdHupaTuEfCTtmYxt2oR5WQ2vFgISoAWtBmA==',
                                      'messageId': 'fd48b1f8-3f82-41cb-9dd1-8a3834e01d86',
                                      'name': 'SetTargetTemperature',
                                      'namespace': 'Alexa.ThermostatController',
                                      'payloadVersion': '3'},
                           'payload': {'targetSetpoint': {'scale': 'CELSIUS',
                                                          'value': 23.5}}}}}

2018-07-20 13:46:56 DEBUG (MainThread) [homeassistant.components.cloud.iot] Publishing message:
{'msgid': '9c8f4a49-54fd-4f97-ad64-f02f158d9957',
 'payload': {'event': {'endpoint': {'cookie': {},
                                    'endpointId': 'climate#thermostat',
                                    'scope': {'token': 'eyJraWQi.............v7tojSxW7GehvBgbb1IU9_R2uakIfw7qZmg9BWqZgngWLbHchtAw',
                                              'type': 'BearerToken'}},
                       'header': {'correlationToken': 'AAAAAAAAAAA7N53jmAaeh9q........RT4mJXkUN684o9N.......NXhtVSfKtqNj/asH+gupmu47HcKRzPMfdVIOMwdHupaTuEfCTtmYxt2oR5WQ2vFgISoAWtBmA==',
                                  'messageId': '65bc6221-7d90-4d13-9e2a-a3e4ecbde21a',
                                  'name': 'Response',
                                  'namespace': 'Alexa',
                                  'payloadVersion': '3'},
                       'payload': {}}}}

2018-07-20 13:46:57 INFO (Thread-19) [homeassistant.components.ecobee] Ecobee data updated successfully

Additional information:

@arigit
Copy link
Contributor Author

arigit commented Jul 20, 2018

I took a look at the Alexa smart home API for thermostats,

https://developer.amazon.com/docs/device-apis/alexa-thermostatcontroller.html

It seems pretty clear that the response needs to include some info:

Response

If a request completes successfully, you send a Response event that indicates the setpoints and the current thermostatMode value.

Single setpoint and HEAT mode example

{
  "context": {
    "properties": [ {
      "namespace": "Alexa.ThermostatController",
      "name": "targetSetpoint",
      "value": {
        "value": 25,
        "scale": "CELSIUS"
      },
      "timeOfSample": "2017-02-03T16:20:50.52Z",
      "uncertaintyInMilliseconds": 500
    }, {
      "namespace": "Alexa.ThermostatController",
      "name": "thermostatMode",
      "value": "HEAT",
      "timeOfSample": "2017-02-03T16:20:50.52Z",
      "uncertaintyInMilliseconds": 500
    } ]
  },
  "event": {
    "header": {
      "namespace": "Alexa",
      "name": "Response",
      "payloadVersion": "3",
      "messageId": "5f8a426e-01e4-4cc9-8b79-65f8bd0fd8a4",
      "correlationToken": "dFMb0z+PgpgdDmluhJ1LddFvSqZ/jCc8ptlAKulUj90jSqg=="
    },
    "endpoint": {
      "endpointId": "appliance-001"
    },
    "payload": {}
  }
}

It seems to follow that HA is sending back a response with no context (broken) since it has nothing in it

@trisk
Copy link
Contributor

trisk commented Aug 3, 2018

I'm working on changes to send the full set of properties in responses, similar to Alexa.ReportState.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.