home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.58k stars 30.75k forks source link

Wemo Integration preventing automatically generated Lovelace Dashboards from loading #46415

Closed jstott1070 closed 3 years ago

jstott1070 commented 3 years ago

The problem

Having recently updated to the latest HA build any automatically generated Lovelace dashboards refuse to load - just get the spinning icon. Manually managed dashboards function fine (Probably don't have an Wemo on them). Rolling back to previous backups (HA Builds) work fine. Checked clearing browser cache, alternative browsers and alternative users with no joy. After stripping back my integrations one by one i found that the Wemo integration was causing the issue. As soon as it is removed the dashboards function again.

Not sure if this is common issue or maybe just me?

What is version of Home Assistant Core has the issue?

2021.2.3

What was the last working version of Home Assistant Core?

2021.2.1 (i think)

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Wemo

Link to integration documentation on our website

https://www.home-assistant.io/integrations/wemo/

Example YAML snippet

# Put your YAML below this line

Anything in the logs that might be useful for us?

# Put your logs below this line
probot-home-assistant[bot] commented 3 years ago

wemo documentation wemo source (message by IssueLinks)

esev commented 3 years ago

@jstott1070 are there any messages in your logs about wemo or pywemo? It could do this if the wemo component took too long to start or if there was an unexpected issue. Which wemo devices are you using?

jstott1070 commented 3 years ago

I will re-enable the intervention and see if I can find anything in the logs.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Eric Severance notifications@github.com Sent: Wednesday, February 17, 2021 2:50:53 AM To: home-assistant/core core@noreply.github.com Cc: jstott1070 jstott1070@hotmail.com; Mention mention@noreply.github.com Subject: Re: [home-assistant/core] Wemo Integration preventing automatically generated Lovelace Dashboards from loading (#46415)

@jstott1070https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjstott1070&data=04%7C01%7C%7Cd14abc5c43944447d5cd08d8d2eed7e8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637491270551394964%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=7053Ph%2BBmo3hFTA1QthhECfjloDruBLJhxVhIPsOra0%3D&reserved=0 are there any messages in your logs about wemo or pywemo?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fhome-assistant%2Fcore%2Fissues%2F46415%23issuecomment-780260549&data=04%7C01%7C%7Cd14abc5c43944447d5cd08d8d2eed7e8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637491270551404923%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9XFCPMJ%2BJm%2FlEfWERNDM2TtLRVunfZRtr6%2Bkw5kP3yQ%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASP2VIEANX6RABLIZACZACLS7MVI3ANCNFSM4XPKPUNQ&data=04%7C01%7C%7Cd14abc5c43944447d5cd08d8d2eed7e8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637491270551404923%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JJK2%2FNtFsOZXeO0BTk3O3Yjn2ywYO9r7VX2iBzCR8ow%3D&reserved=0.

jstott1070 commented 3 years ago

Hi Esev,

Ok so re-enabled the integration and of course its now functioning fine with the dashboards working as expected. Whilst i have been "playing" with other add-ins etc (standard HA user behaviour) i dont believe i have changed anything that would impact the Wemo side of things. The only thing different at the moment is that i have an Insite device registered where as previously i just had 1 basic plug wifi plug connected (one of the old style (Large)) ones. This plug was/is in the loft and as such was hit and miss as to if it connected which was being picked up in the logs, lots of timing out.. I suspect this may well have been the cause of the issue - maybe the dash was expecting the device but the integration could not connect and was timing out?

I will keep an eye on things and see if the loft device comes back online and if it then impacts the dashboards again. To be honest these old devices were always pretty flaky in their connections even using the Wemo app. Probably time to replace them with something more stable and certainly something a little smaller.

esev commented 3 years ago

previously i just had 1 basic plug wifi plug connected (one of the old style (Large)) ones. This plug was/is in the loft and as such was hit and miss as to if it connected which was being picked up in the logs, lots of timing out.

I have one of these (F7C027) too and have the same experience as you.

I suspect this may well have been the cause of the issue - maybe the dash was expecting the device but the integration could not connect and was timing out?

That device could very well cause this issue.

I would have expected it to work after a few minutes, once the setup for that device timed-out. And that's why I'm curious to see the logs if this does occur again. Maybe there is something better that can be done to timeout faster during the initial startup.

I will keep an eye on things and see if the loft device comes back online and if it then impacts the dashboards again.

Thank you!

jstott1070 commented 3 years ago

Hi Eric,

A little more input for you. My switch in the loft did manage to connect back up at some point all be it still with its flaky connection. Interestingly because the switch added itself back in through auto discovery it was unassigned to a zone/space and in this state it was showing fine on the auto populated dashboards. However as soon as I add it to the "Loft" zone, Lovelace fails to load. Note that this switch is the only item within the "Loft" zone so i am wondering if the switch is disconnected at the time Lovelace tries to generate the "Loft" zone group if its at this point the issue is occurring..

Some connection logs from today:

2021-02-18 10:01:16 WARNING (SyncWorker_3) [homeassistant.components.wemo.switch] Could not update status for Loft (Error communicating with Loft after 3 attempts. Giving up.) 2021-02-18 10:01:26 ERROR (SyncWorker_3) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:01:37 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 10:01:42 WARNING (SyncWorker_6) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 0 2021-02-18 10:01:52 ERROR (SyncWorker_6) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:02:02 WARNING (SyncWorker_6) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 1 2021-02-18 10:02:12 ERROR (SyncWorker_6) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:02:22 WARNING (SyncWorker_6) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 2 2021-02-18 10:02:32 ERROR (SyncWorker_6) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:02:32 ERROR (SyncWorker_6) [pywemo.ouimeaux_device.api.service] Error communicating with Loft after 3 attempts. Giving up. 2021-02-18 10:02:32 WARNING (SyncWorker_6) [homeassistant.components.wemo.switch] Could not update status for Loft (Error communicating with Loft after 3 attempts. Giving up.) 2021-02-18 10:02:42 ERROR (SyncWorker_6) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:02:57 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 10:03:02 WARNING (SyncWorker_8) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 0 2021-02-18 10:03:12 ERROR (SyncWorker_8) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:03:22 WARNING (SyncWorker_8) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 1 2021-02-18 10:03:32 ERROR (SyncWorker_8) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:03:42 WARNING (SyncWorker_8) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 2 2021-02-18 10:03:52 ERROR (SyncWorker_8) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:03:52 ERROR (SyncWorker_8) [pywemo.ouimeaux_device.api.service] Error communicating with Loft after 3 attempts. Giving up. 2021-02-18 10:03:52 WARNING (SyncWorker_8) [homeassistant.components.wemo.switch] Could not update status for Loft (Error communicating with Loft after 3 attempts. Giving up.) 2021-02-18 10:04:02 ERROR (SyncWorker_8) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:04:17 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 10:04:22 WARNING (SyncWorker_8) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 0 2021-02-18 10:04:32 ERROR (SyncWorker_8) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:04:42 WARNING (SyncWorker_8) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 1 2021-02-18 10:06:07 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 10:06:12 WARNING (SyncWorker_3) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 0 2021-02-18 10:06:22 ERROR (SyncWorker_3) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:08:17 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 10:08:22 WARNING (SyncWorker_0) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 0 2021-02-18 10:08:32 ERROR (SyncWorker_0) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136 2021-02-18 10:10:17 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 10:10:22 WARNING (SyncWorker_3) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 0 2021-02-18 11:00:23 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 438, in _error_catcher yield File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 519, in read data = self._fp.read(amt) if not fp_closed else b"" File "/usr/local/lib/python3.8/http/client.py", line 458, in read n = self.readinto(b) File "/usr/local/lib/python3.8/http/client.py", line 502, in readinto n = self.fp.readinto(b) File "/usr/local/lib/python3.8/socket.py", line 669, in readinto return self._sock.recv_into(b) socket.timeout: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 753, in generate for chunk in self.raw.stream(chunk_size, decode_content=True): File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 576, in stream data = self.read(amt=amt, decode_content=decode_content) File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 541, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "/usr/local/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 443, in _error_catcher raise ReadTimeoutError(self._pool, None, "Read timed out.") urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.1.136', port=49153): Read timed out. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/wemo/init.py", line 197, in async_discover_and_schedule for device in await self._hass.async_add_executor_job( File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, self.kwargs) File "/usr/local/lib/python3.8/site-packages/pywemo/discovery.py", line 48, in discover_devices device = device_from_description( File "/usr/local/lib/python3.8/site-packages/pywemo/discovery.py", line 62, in device_from_description xml = requests.get(description_url, timeout=10) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 76, in get return request('get', url, params=params, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 697, in send r.content File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 831, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 760, in generate raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.136', port=49153): Read timed out. 2021-02-18 12:31:38 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 12:39:48 WARNING (MainThread) [homeassistant.components.wemo.entity] Lost connection to Loft 2021-02-18 12:39:54 WARNING (SyncWorker_0) [pywemo.ouimeaux_device.api.service] Error communicating with Loft at 192.168.1.136:49153, retry 0 2021-02-18 12:40:04 ERROR (SyncWorker_0) [pywemo.ouimeaux_device] Unable to re-probe wemo at 192.168.1.136

jstott1070 commented 3 years ago

Confirmed - as soon as i remove the entity from the Zone the dashboard works again.

esev commented 3 years ago

Nice troubleshooting!

Do you remember if the dashboards were working at the time these logs were taken? Or could these been from when the dashboard was working?

Do you see any log messages like this near the start of your logs? Setup of wemo is taking over then it usually says a number of seconds. Or any logs that mention async_setup_entry?

I think we're close on solving this. Having the the logs that reference wemo near the start of the logs will help track this down.

jstott1070 commented 3 years ago

Thats pretty much everything i could see in the log - it looks like its filling the logs pretty quickly so i dont have anything further.

I dont know if the dashboard was working at the time but i suspect i took the logs with the dashboard not working. I guess i can reproduce the issue by adding the switch into the room, clearing logs and restarting.. upon reboot the dashboard will not be functioning and i can grab the logs to see if there is anything useful in there.

esev commented 3 years ago

No worries if you can't get the logs. It would be nice to confirm my suspicion, but I think I know what is going on.

There is a fetch of the device description in pywemo v0.6.1 that, if it failed during startup, would cause the wemo component in Home Assistant to never start. You'd see something in the log about an exception that included async_setup_entry if that is what's happening.

pywemo v0.6.2 adds better exception handling and some retries on failure that will avoid having this happen.

pywemo v0.6.2 was just released today. I'm running tests with it now. If all goes well I plan to update Home Assistant this weekend.

jstott1070 commented 3 years ago

Just tried but not managed to trigger anything in the logs - i will keep checking them and let you know if i find anything but it sounds like you have a good idea of what is going on. I will keep an eye out for new releases/updates. Thank you for help, keep up the great work!..

Joe