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

Honeywell Thermostat Stops working after a while (key Error) #8554

Closed
matthewcky2k opened this issue Jul 19, 2017 · 13 comments · Fixed by #9308
Closed

Honeywell Thermostat Stops working after a while (key Error) #8554

matthewcky2k opened this issue Jul 19, 2017 · 13 comments · Fixed by #9308

Comments

@matthewcky2k
Copy link
Contributor

Home Assistant release (hass --version):
0.49

Python release (python3 --version):
3.5.3

Component/platform:
Honeywell Thermostat

Description of problem:
Works fine for a while after HA is started but then stops updating

Expected:
Updates as expected

Problem-relevant configuration.yaml entries and steps to reproduce:

  platform: honeywell
  username: redacted
  password: redacted
  away_temperature: 13.5
  scan_interval: 600

Traceback (if applicable):

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 73, in temperatures
    self._populate_full_data(force_refresh)
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 44, in _populate_full_data
    self.location_id = self.full_data['locationID']
KeyError: 'locationID'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.dining_room fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.guest_bed fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.guest_bed_upper fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.hall fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.kitchen fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.living_room fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.man_cave fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.master_bed fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'
2017-07-18 07:03:32 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.rear_hall fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 309, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/climate/honeywell.py", line 195, in update
    for val in self.device.temperatures(force_refresh=self._master):
  File "/root/.homeassistant/deps/evohomeclient/__init__.py", line 74, in temperatures
    for device in self.full_data['devices']:
KeyError: 'devices'

Additional info:

@matthewcky2k
Copy link
Contributor Author

Anyone has any idea on this one?

@matthewcky2k
Copy link
Contributor Author

@watchforstock do you have any insight?

@watchforstock
Copy link
Contributor

I would guess that for some reason the API isn't returning valid content for some reason. From a quick scan of the code (https://github.com/watchforstock/evohome-client/blob/master/evohomeclient/__init__.py#L40) it looks like the response code isn't being tested to check it succeeded. Ideally it should be throwing an exception to be caught by the home assistant code. I've not heard reports of this - either home assistant is querying more regularly than others or people are using the evohomeclient2 package which has a different code path.

@matthewcky2k
Copy link
Contributor Author

Ok thanks for your input perhaps another HA Dev can take a look? off thing is as soon as HA restarts it works fine again.

@rowco
Copy link

rowco commented Jul 24, 2017

For info, I've hitting the same fault since moving to 0.49:

2017-07-24 09:52:04 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.snug fails Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state yield from self.hass.async_add_job(self.update) File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__ yield self # This tells Task to wait for completion. File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup future.result() File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result raise self._exception File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.6/site-packages/homeassistant/components/climate/honeywell.py", line 195, in update for val in self.device.temperatures(force_refresh=self._master): File "/usr/lib/python3.6/site-packages/evohomeclient/__init__.py", line 74, in temperatures for device in self.full_data['devices']: KeyError: 'devices'

@matthewcky2k
Copy link
Contributor Author

@balloob or @fabaff @turbokongen do you have any input here?

@namadori
Copy link
Contributor

namadori commented Aug 4, 2017

Hi all,
I am working on the Honeywell component to adapt its behaviour for the multi-zone Evohome wifi thermostat. You can follow the progresses (and contribute :-) ) on https://community.home-assistant.io/t/update-honeywell-thermostat-component-to-new-api/23371 , code on https://github.com/namadori/honeywell .

I had the thermostat working with the current honeywel component for about two weeks, and never got an error message. As soon I updated the references to the evohomeclient library I got in the log errors similar to the one reported:

2017-08-03 23:51:48 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.letto fails
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climate/honeywell2.py", line 194, in update
    for val in self.client.temperatures():
  File "/usr/lib/python3.6/site-packages/evohomeclient2/controlsystem.py", line 66, in temperatures
    status = self.location.status()
  File "/usr/lib/python3.6/site-packages/evohomeclient2/location.py", line 26, in status
    for gw in data['gateways']:
TypeError: list indices must be integers or slices, not str

My first guess is that this can be linked to Honeywell rate-limiting API requests, as it seems the v1 library had some sort of request caching that is not implemented in v2.

It seems also that the someconfort library for the us thermostats has a rate limiting detection (looks for HTTP 401 in the response) that is not implemented in the evohomeclient library.

@matthewcky2k , can you try to enable debugging to see if we can have more info on the issue? You have to edit the honeywell.py component, line 72, from
client = EvohomeClient(username, password)
to
client = EvohomeClient(username, password, debug=True)

@dansarginson
Copy link
Contributor

I'm just testing a fix for this. The session ID is only valid for an hour but the user data is never updated because of this check here. PR incoming if it behaves as expected.

@matthewcky2k
Copy link
Contributor Author

ok thanks @dansarginson

@dansarginson
Copy link
Contributor

Hmm, apologies but I had the two APIs mixed up in my head. I suspect the correct answer is @namadori's work to move to the new API.

@mattjam
Copy link

mattjam commented Aug 24, 2017

I think I'm seeing something similar, thermostats don't update until I restart then all the data comes in. I tried to enabled debug but am getting this in the log file:

evo_api = EvohomeClient(username, password, debug=True)
TypeError: init() got an unexpected keyword argument 'debug'

@dansarginson
Copy link
Contributor

@mattjam that won't work unfortunately since we're not on the evohomeclient2 library.

I'm currently testing another fix for this (the test time is quite long since I can't force it into error quicker than a day or two) so heads up for a PR if I can confirm the right effect.

For anyone who's interested, I still think that the token we get back from the Honeywell API eventually times out. This is no surprise; Honeywell shouldn't issue authentication tokens that don't age off. We eventually get an exception here when we ask the evohomeclient library to try to read from a dictionary that no longer contains any devices. When our authentication token times out, there's no way for the library to get a new one, but if we set all of the user data in the client to 'None' when catching the exception, I'm hoping all will be well.

@mattjam
Copy link

mattjam commented Aug 29, 2017

Thanks @dansarginson

I've done a bit more testing and I'm wondering if what I'm seeing is related to the changes in History query (#8748)

With my setup, the graph doesn't update after restarting hass. When I do restart, the past data then populates properly but no new data ever gets added, i.e. the problem is immediate for me and doesn't take a few days for a session to expire.

Looking at the database, I can see new entries are indeed there, although the order of the json objects looks slightly different.

dansarginson added a commit to dansarginson/home-assistant that referenced this issue Sep 5, 2017
This fixes an issue (home-assistant#8554) whereby the Honeywell thermostats stopped
working after a period of hours or days. We do this by forgetting the
authorisation token that was sent back to us when we first logged in,
which causes the underlying evohomeclient library to perform the full
login procedure again.
fabaff pushed a commit that referenced this issue Sep 5, 2017
This fixes an issue (#8554) whereby the Honeywell thermostats stopped
working after a period of hours or days. We do this by forgetting the
authorisation token that was sent back to us when we first logged in,
which causes the underlying evohomeclient library to perform the full
login procedure again.
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants