Closed allanedk closed 3 years ago
Im seeing the same problem. The connection works again after a HA reboot.
I also see the same problem, it runs for 2-3 hours and then requires a reboot to get access again.
I restarted and it worked again. However, after exactly 3 hours it stopped working and I seethe "Unauthorized" entries in the log again.
I just checked and the tokens returned by the API contain an expires_in
value. Mine was 10800 seconds which would be 3 hours. I think the code needs modified such that when the update_data
method gets a 401
response it needs to set self.access_token = None
then await self.get_user_credentials()
to obtain a new authorization token before trying the call again.
Sounds good. Thank you - looking forward to try it.
This has been working like a charm for the past couple of days.
Thanks a lot!
Thank you for sharing your code!
I installed the component yesterday and it worked fine. I see in the logs, that a couple of hours later the the calls to to Airthings server started to fail:
Maybe there's a max number of allowed calls to the Airthings server? However I am able to login to the Airthings dashboard using a browser (from the same IP + user credentials).