Core: Sensibo component broken if AC without target temperature is present

Created on 23 Nov 2017  路  10Comments  路  Source: home-assistant/core

Home Assistant release (hass --version):0.58
Python release (python3 --version):3.6
Component/platform:Sensibo
Description of problem:Error in HA log following restart, platform isn't loaded
Expected: Platform loaded successfully
Problem-relevant configuration.yaml entries and steps to reproduce:

climate:
  - platform: sensibo
    api_key: !secret sensibo_api_key

Traceback (if applicable):

2017-11-23 20:59:53 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform sensibo
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/climate/sensibo.py", line 55, in async_setup_platform
    devices.append(SensiboClimate(client, dev))
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/climate/sensibo.py", line 76, in __init__
    self._do_update(data)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/climate/sensibo.py", line 87, in _do_update
    temperature_unit_key = self._ac_states['temperatureUnit']
KeyError: 'temperatureUnit'

Additional info:

All 10 comments

That is weird and shouldn't happen. That code wasn't touched, and the library wasn't updated. @andrey-git ?

@ohadbenita did the same unit worked before 0.57?

Could you post the result of
curl "https://home.sensibo.com/api/v2/pods/POD_ID?apiKey=API_KEY&fields=*"
Don't forget the quotes. Remove any sensitive info.

I did it from my Windows browser and the result:

{"status": "success", "result": {"configGroup": "stable", "macAddress": "MY_MAC_ADDRESS", "cleanFiltersNotificationEnabled": true, "measurements": {"batteryVoltage": null, "temperature": 20.9, "humidity": 43.5, "time": {"secondsAgo": 32, "time": "2017-11-25T06:15:56.993000Z"}, "rssi": -34, "piezo": [null, null]}, "firmwareType": "cc3100_stm32f0", "productModel": "skyv2", "currentlyAvailableFirmwareVersion": "IN010050", "temperatureUnit": "C", "isGeofenceOnExitEnabled": false, "connectionStatus": {"isAlive": true, "lastSeen": {"secondsAgo": 32, "time": "2017-11-25T06:15:56.993000Z"}}, "acState": {"on": true, "fanLevel": "auto", "temperatureUnit": "C", "targetTemperature": 23, "mode": "heat", "swing": "stopped"}, "smartMode": null, "shouldShowFilterCleaningNotification": false, "location": {"latLon": [0, 0], "updateTime": null, "country": "X", "createTime": {"secondsAgo": 10099806, "time": "2017-07-31T08:46:23Z"}, "address": ["MY_STREET", "MY_CITY"], "id": "My_ID"}, "remoteCapabilities": {"modes": {"dry": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low"]}, "auto": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "heat": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "fan": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "cool": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}}}, "id": "MY_POD_ID", "firmwareVersion": "IN010050", "room": {"name": "Living Room AC", "icon": "Livingroom"}}}

However, when I run curl from the RPI where the HA is running I get :

$ {"status": "success", "result": {"id": "POD_ID"}}

Doing another attempt following reboot :

{"status": "success", "result": {"configGroup": "stable", "macAddress": "MAC_ADDRESS", "cleanFiltersNotificationEnabled": true, "measurements": {"batteryVoltage": null, "temperature": 20.0, "humidity": 41.9, "time": {"secondsAgo": 2, "time": "2017-11-25T10:57:13.759000Z"}, "rssi": -37, "piezo": [null, null]}, "firmwareType": "cc3100_stm32f0", "productModel": "skyv2", "currentlyAvailableFirmwareVersion": "IN010050", "temperatureUnit": "C", "isGeofenceOnExitEnabled": false, "connectionStatus": {"isAlive": true, "lastSeen": {"secondsAgo": 2, "time": "2017-11-25T10:57:13.759000Z"}}, "acState": {"on": false, "fanLevel": "auto", "temperatureUnit": "C", "targetTemperature": 23, "mode": "heat", "swing": "stopped"}, "smartMode": null, "shouldShowFilterCleaningNotification": false, "location": {"latLon": [0,0], "updateTime": null, "country": "X", "createTime": {"secondsAgo": 10116653, "time": "2017-07-31T08:46:23Z"}, "address": ["MY_ADDRESS", "MY_ADDRESS"], "id": "rTdSSLf6BS"}, "remoteCapabilities": {"modes": {"dry": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low"]}, "auto": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "heat": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "fan": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "cool": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}}}, "id": "ID", "firmwareVersion": "IN010050", "room": {"name": "Living Room AC", "icon": "Livingroom"}}

And still the issue persists

Try
curl "https://home.sensibo.com/api/v2/users/me/pods?apiKey=API_KEY&fields=id,room{name},measurements,remoteCapabilities,acState,connectionStatus{isAlive}"

{"status": "success", "result": [{"acState": {"on": false, "fanLevel": "auto", "temperatureUnit": "C", "targetTemperature": 23, "mode": "heat", "swing": "stopped"}, "remoteCapabilities": {"modes": {"dry": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low"]}, "auto": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "heat": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "fan": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "cool": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}}}, "measurements": {"batteryVoltage": null, "temperature": 20.0, "humidity": 42.2, "time": {"secondsAgo": 16, "time": "2017-11-25T19:22:55.425000Z"}, "rssi": -38, "piezo": [null, null]}, "id": "MY_ID"}, {"acState": {"on": false, "swing": "stopped", "mode": "auto", "fanLevel": "auto"}, "remoteCapabilities": {"modes": {"dry": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low"]}, "auto": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "heat": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "fan": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "cool": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}}}, "measurements": {"batteryVoltage": null, "temperature": 18.3, "humidity": 53.7, "time": {"secondsAgo": 79, "time": "2017-11-25T19:21:52.965000Z"}, "rssi": -66, "piezo": [null, null]}, "id": "MY_ID_2"}, {"acState": {"on": false, "fanLevel": "low", "temperatureUnit": "C", "targetTemperature": 23, "mode": "heat", "swing": "stopped"}, "remoteCapabilities": {"modes": {"dry": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low"]}, "auto": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "heat": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "fan": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}, "cool": {"swing": ["stopped", "fixedTop", "fixedMiddleTop", "fixedMiddle", "fixedMiddleBottom", "fixedBottom", "rangeTop", "rangeMiddle", "rangeBottom", "rangeFull"], "temperatures": {"C": {"isNative": true, "values": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]}, "F": {"isNative": false, "values": [61, 63, 64, 66, 68, 70, 72, 73, 75, 77, 79, 81, 82, 84, 86]}}, "fanLevels": ["low", "medium", "high", "auto", "strong"]}}}, "measurements": {"batteryVoltage": null, "temperature": 18.6, "humidity": 47.8, "time": {"secondsAgo": 85, "time": "2017-11-25T19:21:46.508000Z"}, "rssi": -51, "piezo": [null, null]}, "id": "MY_ID_3"}]}

OK, so I see that for all 3 your A/C units in "auto" mode the "temperatures" is empty in capabilities.

For the 2nd unit the temperature is also missing from acState. What kind of AC is that? This seems like a bug in Sensibo API to me.

So, auto mode on this AC doesn't display temperature, so it doesn't exist.
However, we have added to the API temperatureUnit outside of the specific acState which always exists. So the integration can be fixed by taking temperature unit from the device itself:
try https://home.sensibo.com/api/v2/pods/POD_UID?fields=temperatureUnit

Thanks, I added it to #10801

I edited the issue title to indicate the rootcause

Was this page helpful?
0 / 5 - 0 ratings