Yes @namadori’s code does stop working after an hour. It’s because it uses evohome-client2 (which uses v2 of the honeywell API), after the OAuth token runs out. There is a way to extend token life - but it seems (to my noob eyes) that this is not exposed within the evohome-client2 code.
Anyway, I have added the following work-around to @namadori’s code (my update code is different to @namadori’s , for val in self.client.temp...
):
def update(self): try: ... except TypeError: _LOGGER.error("Update failed: TypeError (has token timed out?)") self.client.access_token = None self.client._login() return
I don’t think it is very pretty, but it works! My log file looks like this (FYI, HA was started at 18:07):
root@lxc-home:/home/hass/.homeassistant# cat home-assistant.log | grep -E ERROR 2018-04-03 19:07:21 ERROR (SyncWorker_7) [custom_components.climate.evohome] Update failed: TypeError (has token timed out?) 2018-04-03 19:07:21 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1522778841.8843508, level=ERROR, message=Update failed: TypeError (has token timed out?), exception=, source=custom_components/climate/evohome.py> 2018-04-03 20:07:33 ERROR (SyncWorker_8) [custom_components.climate.evohome] Update failed: TypeError (has token timed out?) 2018-04-03 20:07:33 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1522782453.8973763, level=ERROR, message=Update failed: TypeError (has token timed out?), exception=, source=custom_components/climate/evohome.py> 2018-04-03 21:07:45 ERROR (SyncWorker_8) [custom_components.climate.evohome] Update failed: TypeError (has token timed out?) 2018-04-03 21:07:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1522786065.8959394, level=ERROR, message=Update failed: TypeError (has token timed out?), exception=, source=custom_components/climate/evohome.py>
Notice an ERROR every hour, rather than every 5 mins after the first hour. Other than that, it behaves as expected.