benleb / surepy

🐾 Library & CLI to monitor and control the Pet Door & Cat Flap Connect 🚪 the Pet Feeder Connect 🍽 and the Felaqua 💦 sold by Sure Petcare
https://pypi.org/project/surepy/
MIT License
76 stars 36 forks source link

Intermittent Errors With the SurePet HomeAssistant integrations on reboot of Home Assistant #1

Closed crgreenwood closed 4 years ago

crgreenwood commented 4 years ago

Since Home Assistant v0.108.0 (or around) I've seen intermittent errors from the SurePet integration when restarting Home Assistant. Errors are as follows:

2020-04-16 21:00:02 ERROR (MainThread) [surepy] Can not load data from https://app.api.surehub.io/api/me/start 2020-04-16 21:00:02 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong ! 2020-04-16 21:00:02 ERROR (MainThread) [homeassistant.setup] Setup failed for surepetcare: Integration failed to initialize.

The issue is intermittent and is generally fixed by restarting Home Assistant repeatedly until it comes up successfully. Once it is up it is completely reliable.

Thanks for a great integration and please let me know if I can provide more detail to assistant with identification and resolution.

crgreenwood commented 4 years ago

@benleb I've done a little digging. It appears that the version of surepy distributed with the latest version of HA is surepy v0.2.3 despite the fact that you released v0.2.4 in Feb. Looking at the changes in v0.2.4 it appears that you've make the connection attempt obey the API_TIMEOUT which is 10 instead of the hardcoded value of 5 in v0.2.3. I've manually made the change in my running installation and it has resolved the issue. So my issue above is not caused by the latest version of surepy but by the fact that HA is still distributing an older version of surepy. Is this an oversight or is there a blocker?

benleb commented 4 years ago

Not actually a surepy issue ;)

But should be fixed via https://github.com/home-assistant/core/pull/34944

crgreenwood commented 4 years ago

Thanks Ben.