core: Simplisafe integration starts getting 401 errors
Home Assistant release with the issue: 0.92.1
Last working Home Assistant release (if known): UNKNOWN
Operating environment (Hass.io/Docker/Windows/etc.): hass.io raspberry pi 3B
Component/platform: https://www.home-assistant.io/components/simplisafe/ Setup through “Configuration/integrations”
Description of problem: Ive reset my entire home assistant setup a couple times now from a fresh hassio release and every time after a couple weeks of working perfectly it will stop getting updates and stop sending events and start getting this error:
There was error updating "MYADDRESS": Error requesting data from users/823242/subscriptions: 401, message='Unauthorized'
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
Traceback (if applicable):
Additional information:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 58 (31 by maintainers)
In correcting the unhandled exception, I think I also addressed a use case where the access token could be “corrupted” due to overlapping calls: #23680
Alright, I think I have something – my forthcoming PR should fall back to the refresh token stored in the HASS config directory (which always seems to be good since HASS restarts fix things) when we get in this strange loop.
Yep, I haven’t hit this lately, either - though I’ve had to restart HA a few times, so it may have just not reached the requisite time. Thanks for diving into this. I’ll keep an eye out for it in the future; leaving SimpliSafe in debug mode for now.
Well… This started happening to me, too. 😒I see these logs:
Same story: after I restart HASS, everything starts working again. This tells me that the refresh token stored by HASS is still valid; it’s just not getting picked up when there’s an error. That gives me something to work with. More soon.
Got it – makes sense.
That’s my fault: I forgot to have you import that package. At any rate, that test was slightly flawed: since this error seems to manifest after a while, a one-off test wouldn’t show it.
Let’s let your system run for a bit and see what the logs say when the issue reoccurs. Thanks for your patience!
Sure thing. Before I clear the logs, here are the timestamps of the errors:
Got it! Once this fix is officially released, give it a try and let me know how you get on.
I actually never tried to just restart to fix it… 🤦 once i restart it works hahah thank you so much!! And thank you for the fixes!! Its so cool to have everything integrated with my alarm system!
Thanks, @kevindurb. RE: the 401 errors, do you get several in a row? How long does “it will stop getting updates and stop sending events” last before you have to restart?
RE: 500 errors, that will happen from time to time – that’s 100% on SimpliSafe’s cloud. That said, I should handle the exception properly.