Adding the virgintivo media player to my configuration.yaml is causing my surepetcare integration to fail to launch with errors in surepetcare. If I comment out the virgintivo media player, it starts ok.
Surepetcare integration code: https://github.com/home-assistant/core/tree/dev/homeassistant/components/surepetcare
Virgin Tivo media player code: https://github.com/bertbert72/HomeAssistant_VirginTivo
System info:
arch | aarch64
-- | --
dev | false
docker | true
hassio | true
os_name | Linux
python_version | 3.7.6
timezone | Europe/London
version | 0.106.5
virtualenv | false
configuration.yamlConfiguration:
# Sure Petcare products
surepetcare:
username: <[email protected]>
password: <password>
feeders: [1111, 2222]
flaps: [3333]
pets: [4444, 5555, 6666, 7777, 8888]
# Virgin Media Tivo
media_player vm_tivo:
- platform: virgintivo
scan_interval: 5
show_packages: Free-to-air,Player,Full House
tivos:
1:
name: Virgin V6
host: nnn.nnn.nnn.nnn
force_hd: true
guide:
enable_guide: True
picture_refresh: 60
tvchannellists:
enable: True
Error in logs:
2020-03-08 15:21:52 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong !
2020-03-08 15:21:52 ERROR (MainThread) [homeassistant.setup] Setup failed for surepetcare: Integration failed to initialize.
I also get the same issue/errors with the virgintivo configuration all commented out, but using:
surepetcare:
username: !secret surepetcare_u
password: !secret surepetcare_p
in the configuration.yaml, when trying to move the username and password to secret.yaml
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!
It seems to be timing out doing the initial auth, when using !secret surepetcare_u and !secret surepetcare_p even though it is pulling in the correct values.
Failing with username and password referenced into secret.yaml
2020-03-08 20:55:32 INFO (MainThread) [homeassistant.setup] Setting up surepetcare
2020-03-08 20:55:32 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.SurePetcare object at 0x7f87ce7d10>, 'email': '<correctEmail>', 'password': '<correctPassword>', 'loop': <_UnixSelectorEventLoop running=True closed=False debug=False>, 'session': <aiohttp.client.ClientSession object at 0x7f8b655550>, 'auth_token': None}
2020-03-08 20:55:32 DEBUG (MainThread) [surepy] self._auth_token: None
2020-03-08 20:55:42 WARNING (MainThread) [homeassistant.setup] Setup of surepetcare is taking over 10 seconds.
2020-03-08 20:55:43 DEBUG (MainThread) [surepy] Timeout while calling https://app.api.surehub.io/api/auth/login:
2020-03-08 20:55:43 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong !
2020-03-08 20:55:43 INFO (MainThread) [homeassistant.setup] Setup of domain surepetcare took 10.9 seconds.
2020-03-08 20:55:43 ERROR (MainThread) [homeassistant.setup] Setup failed for surepetcare: Integration failed to initialize.
Working with username and password in configuration.yaml:
2020-03-08 21:15:28 INFO (MainThread) [homeassistant.setup] Setting up surepetcare
2020-03-08 21:15:28 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.SurePetcare object at 0x7fb041abd0>, 'email': '<correctEmail>', 'password': '<correctPassword>', 'loop': <_UnixSelectorEventLoop running=True closed=False debug=False>, 'session': <aiohttp.client.ClientSession object at 0x7fb3d4f490>, 'auth_token': None}
2020-03-08 21:15:28 DEBUG (MainThread) [surepy] self._auth_token: None
2020-03-08 21:15:39 DEBUG (MainThread) [surepy] headers: {'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'Origin': 'https://surepetcare.io', 'User-Agent': 'Mozilla/5.0 (Linux; Android 7.0; SM-G930F Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36', 'Referer': 'https://surepetcare.io/', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en-GB;q=0.9', 'X-Requested-With': 'com.sureflap.surepetcare', 'Authorization': '<auth token>'}
2020-03-08 21:15:39 WARNING (MainThread) [homeassistant.setup] Setup of surepetcare is taking over 10 seconds.
2020-03-08 21:15:42 DEBUG (MainThread) [surepy] response.status: 200
2020-03-08 21:15:42 DEBUG (MainThread) [homeassistant.components.surepetcare] Devices and Pets to setup: <Pet / device ids>
2020-03-08 21:15:42 DEBUG (MainThread) [surepy] self._auth_token: <auth token>
2020-03-08 21:15:42 DEBUG (MainThread) [surepy] using available Etag in headers: {'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'Origin': 'https://surepetcare.io', 'User-Agent': 'Mozilla/5.0 (Linux; Android 7.0; SM-G930F Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36', 'Referer': 'https://surepetcare.io/', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en-GB;q=0.9', 'X-Requested-With': 'com.sureflap.surepetcare', 'Authorization': <auth token>, 'Etag': '0skFfXp116XSdWdmgJdj9KpEF64='}
2020-03-08 21:15:42 DEBUG (MainThread) [surepy] headers: {'Connection': 'keep-alive', 'Accept': 'application/json, text/plain, */*', 'Origin': 'https://surepetcare.io', 'User-Agent': 'Mozilla/5.0 (Linux; Android 7.0; SM-G930F Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/64.0.3282.137 Mobile Safari/537.36', 'Referer': 'https://surepetcare.io/', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en-GB;q=0.9', 'X-Requested-With': 'com.sureflap.surepetcare', 'Authorization': <auth token>, 'Etag': '0skFfXp116XSdWdmgJdj9KpEF64='}
2020-03-08 21:15:46 DEBUG (MainThread) [surepy] response.status: 200
2020-03-08 21:15:46 INFO (MainThread) [homeassistant.setup] Setup of domain surepetcare took 17.4 seconds.
Same error at my side even without using secret.yaml
Same problem here on 107.5 without using secret.yaml
Any news on this one?
Still a problem om 108.x, but from what I can understand this might be a problem with the api host, and not home assistant, but maybe the retry mechanism in home assistant could be improved?
I changed HW from raspberry Pi 3 to raspberry Pi 4 for other reason. Using same yams configs it's working now for me also using secrets.yaml. Seems to be no general problem but maybe time out or race condition related.
I'm having same problems. Not using secret.yaml, just user and password in config file. Whed do you mean by "I changed HW from PR3 to RP4" @to-scho ?
Hi @Arken77, I updated my comment above. Sorry for typo and lazyness.
Ah, now I get it, @to-scho :) I'm running Hassio on a Raspberry Pie 3, but I'm planning to put it in Docker on my Plex media server running on I5 processor. Just not sure how to move everything, including settings for Zigbee (running deconz with USB dongle on the Pie now and most of my smart home stuff is Zigbee now).
If it's a problem with speed of the machine, as moving from Pie 3 to Pie 4 might suggest, then I guess that running on a real computer would help even more.
I've been running the surepetcare integration since before it was included in official Home Assistant. Before I've just added the custom component I've downloaded into my Home assistant from Github. It kind of worked back then. Sure after SOME restarts the sensor for the cats were unavailable, but another restart of Hassio or two used to fix it. And also, battery sensor for the flap almost never worked for me. It was a rare thing when I've got BOTH the battery sensor AND sensors for the cats.
So when I've found out that it's now official integration I've deleted the custom component and jumped on the updated version. And that one never worked for me at all unfortunately. Always refuses to start.
Oh well, maybe moving the Hassio to my server will help? Just have to find time to move everything.
There is a hardcoded 10 second timeout in surepy - https://github.com/benleb/surepy/blob/master/surepy/__init__.py#L31
I think this is the underlying cause of this issue. It seems sometimes the Sure Petcare servers are slow to respond. Ideally we'd be able to customise this timeout, with a default of 10 seconds...
a fix is on the way
@benleb Will the updated version be part of future Home Assistent update or do I have to download something manually?
Will be part of (the next?) Hass release :)
Most helpful comment
a fix is on the way