Closed i00 closed 4 years ago
Hey there @benleb, mind taking a look at this issue as its been labeled with a integration (surepetcare
) you are listed as a codeowner for? Thanks!
OK ... must have been a temp thing ... started working again yest
I am not so sure that it has been resolved yet.
After reading your comment, I have restarted my Home Assisstant and still got the error:
2020-04-04 08:27:46 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong !
What about other users?
Ok ... I restarted it again today and got the same issue???
Also it shouldn't just say a generic there "is an issue with my config" (which there is not) and fall over... why can't it back off and try again?
Ok it seems that sometimes their server is inaccessible for short periods of times and that the integration never bothers to try and reconnect to it again if the connection fails the first time with this incorrect message in the notifications:
... the real message that I posted in the op is in the log ... but still this is not a config issue and should not result in it breaking until HA is next restarted.
Version 0.108.3 still has this issue.
I've spent some time investigating this evening as, after adding another integration I saw this go from an intermittent issue to something that I experienced on nearly every restart. It appears that version of @benleb 's surepy library that is specified by the surepetcare component is one level down (0.2.3) from the latest the @benleb has published on pypi (v0.2.4). In v0.2.3 the API_TIMEOUT value is ignored when the connection is tried and is instead hardcoded to 5 seconds. In v0.2.4 he's updated the code to use the API_TIMEOUT value of 10 seconds (among other changes). I'm not sure why he hasn't yet updated the component to use the newer version. In the meantime I have successfully tested both updating to v0.2.4 and also hacking v0.2.3 to use the API_TIMEOUT variable (set to 10) instead of 5 on my own installation as a short term fix.
@crgreenwood, can you provide me a more detailed explanation on how to hack v0.2.3 to use the longer timeout?
@tomverboon I exec'ed into the homeassistant container on my installation (through Portainer). Once in you can run:
pip list | grep surepy
to ensure that you are already running surepy v0.2.3.
Then edit the file with:
vi /usr/local/lib/python3.7/site-packages/surepy/__init__.py
On line 146 after async_timeout.timeout(
replace 5
with API_TIMEOUT
(which is already defined further up the file. The resulting line should read: with async_timeout.timeout(API_TIMEOUT, loop=self._loop):
Save and quit. This is super hacky and will need repeating after every homeassistant update but has taken me from the integration being effectively broken to working again. There are other changes in the latest library from @benleb but this change seems to do the job.
@tomverboon I exec'ed into the homeassistant container on my installation (through Portainer). Once in you can run:
pip list | grep surepy
to ensure that you are already running surepy v0.2.3. Then edit the file with:vi /usr/local/lib/python3.7/site-packages/surepy/__init__.py
On line 146 afterasync_timeout.timeout(
replace5
withAPI_TIMEOUT
(which is already defined further up the file. The resulting line should read:with async_timeout.timeout(API_TIMEOUT, loop=self._loop):
Save and quit. This is super hacky and will need repeating after every homeassistant update but has taken me from the integration being effectively broken to working again. There are other changes in the latest library from @benleb but this change seems to do the job.
Thanks for the instructions, much appreciated.
The problem
4:00 yesterday stopped working with: Unable to connect to surepetcare.io: Wrong ! Web page and phone app still work without issue
Environment
Problem-relevant
configuration.yaml
Traceback/Error logs
Additional information