home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.7k stars 30.83k forks source link

LaMetric oath token expires #9420

Closed DubhAd closed 7 years ago

DubhAd commented 7 years ago

Home Assistant release (hass --version):0.53.0

Python release (python3 --version): Python 3.4.2

Component/platform: LaMetric (https://home-assistant.io/components/lametric/)

Description of problem: At some point after HA starts, LaMetric notifications no longer work, with an oath error of token_expired. The command line client using the same API details works without issue.

Expected: Token is renewed when required.

Traceback (if applicable):

Sep 13 19:49:10 jarvis hass[1248]: 2017-09-13 20:49:10 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Sep 13 19:49:10 jarvis hass[1248]: Traceback (most recent call last):
Sep 13 19:49:10 jarvis hass[1248]: File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
Sep 13 19:49:10 jarvis hass[1248]: result = coro.throw(exc)
Sep 13 19:49:10 jarvis hass[1248]: File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/core.py", line 1025, in _event_to_service_call
Sep 13 19:49:10 jarvis hass[1248]: yield from service_handler.func(service_call)
Sep 13 19:49:10 jarvis hass[1248]: File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/notify/__init__.py", line 143, in async_notify_message
Sep 13 19:49:10 jarvis hass[1248]: yield from notify_service.async_send_message(**kwargs)
Sep 13 19:49:10 jarvis hass[1248]: File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
Sep 13 19:49:10 jarvis hass[1248]: yield self  # This tells Task to wait for completion.
Sep 13 19:49:10 jarvis hass[1248]: File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
Sep 13 19:49:10 jarvis hass[1248]: value = future.result()
Sep 13 19:49:10 jarvis hass[1248]: File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
Sep 13 19:49:10 jarvis hass[1248]: raise self._exception
Sep 13 19:49:10 jarvis hass[1248]: File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
Sep 13 19:49:10 jarvis hass[1248]: result = self.fn(*self.args, **self.kwargs)
Sep 13 19:49:10 jarvis hass[1248]: File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/notify/lametric.py", line 86, in send_message
Sep 13 19:49:10 jarvis hass[1248]: devices = lmn.get_devices()
Sep 13 19:49:10 jarvis hass[1248]: File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/lmnotify/lmnotify.py", line 180, in get_devices
Sep 13 19:49:10 jarvis hass[1248]: r = self.oauth.get(CLOUD_URLS["get_devices"][1])
Sep 13 19:49:10 jarvis hass[1248]: File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests/sessions.py", line 531, in get
Sep 13 19:49:10 jarvis hass[1248]: return self.request('GET', url, **kwargs)
Sep 13 19:49:10 jarvis hass[1248]: File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py", line 330, in request
Sep 13 19:49:10 jarvis hass[1248]: http_method=method, body=data, headers=headers)
Sep 13 19:49:10 jarvis hass[1248]: File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/oauthlib/oauth2/rfc6749/clients/base.py", line 194, in add_token
Sep 13 19:49:10 jarvis hass[1248]: raise TokenExpiredError()
Sep 13 19:49:10 jarvis hass[1248]: oauthlib.oauth2.rfc6749.errors.TokenExpiredError: (token_expired) 
DubhAd commented 7 years ago

@open-homeautomation as you submitted the original component, would you be able to look into this please?