I need to reauthenticate withings a few times a day. Is that an expected behavior?
configuration.yaml
withings:
client_id: !secret withings_client_id
client_secret: !secret withings_client_secret
2020-11-01 10:12:24 ERROR (MainThread) [homeassistant.components.withings] Unexpected error fetching poll_data_update_coordinator data: 'dict' object has no attribute 'context'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 734, in async_get_all_data
return await self._do_retry(self._async_get_all_data)
File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 654, in _do_retry
raise exception
File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 647, in _do_retry
return await func()
File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 770, in _async_get_all_data
**await self.async_get_measures(),
File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 778, in async_get_measures
response = await self._hass.async_add_executor_job(self._api.measure_get_meas)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/withings_api/__init__.py", line 159, in measure_get_meas
self.request(path=self.PATH_MEASURE, params=params)
File "/usr/local/lib/python3.8/site-packages/withings_api/__init__.py", line 81, in request
return response_body_or_raise(
File "/usr/local/lib/python3.8/site-packages/withings_api/common.py", line 894, in response_body_or_raise
raise AuthFailedException(status=status)
withings_api.common.AuthFailedException: Error code 401
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 144, in async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 132, in _async_update_data
return await self.update_method()
File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 747, in async_get_all_data
flow = next(
File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 751, in <genexpr>
if flow.context == context
AttributeError: 'dict' object has no attribute 'context'
Here are the screenshots of how i temporarily workaround this problem:
But as said, this needs to be done a few times a day.
Regards
Richard
Hey there @vangorra, mind taking a look at this issue as its been labeled with an integration (withings
) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
I noticed the same behavior -- this can be replicated by restarting Home Assistant once or twice.
Happy to provide additional information or help track down the issues if it helps.
I'm having the same issue too.
Same here!
To add my two cents, I have the same issue - but for me it is once a day.
My config uses the webhook. Reauthentication is a fast two click process, that never fails, but still - annoying.
Theorizing on cause: Withings kills the token on their side due to... too many requests? wrong requests? change in their API?
Happy to help debugging - very happy (Read VERY HAPPY) with the integration.
Update:18 nov... it鈥檚 been stable few days now, not updated a thing, but broke again on the 4th day
It's possible this is caused by withings changing their required params for refresh tokens. This was fixed upstream and I'm soak testing the fix. https://github.com/vangorra/python_withings_api/releases/tag/2.1.9
I have been experiencing this same issue over the last month or so. The pattern on my end seems to be every 2 or 3 days I'll get a notification the integration needs to be reconfigured (images 1&2 of OP's post). I've never actually reconfigured though. I just dismiss the notification and a few hours later the reconfiguration card on the integrations page has disappeared and everything appears to be back to normal.
That said, every time this event happens, it appears to drop data for the period it thinks the integration needs to be reconfigured (below - values briefly drop to zero).
If this has been fixed already and is pending release, then awesome. If not, just adding supplemental info in case it helps.
btw: posting this today b/c still seeing on latest 0.118.0 release
Same issue on my side. I'm on 0.118.3 Comes back multiple times a day.
Yep. Still working on a fix. Is a hard one to track down as there is such a long delay between failures.
Most helpful comment
It's possible this is caused by withings changing their required params for refresh tokens. This was fixed upstream and I'm soak testing the fix. https://github.com/vangorra/python_withings_api/releases/tag/2.1.9