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
70.04k stars 29.11k forks source link

WLED device becoming unavailable at seemingly random intervals #110235

Open Aaroneisele55 opened 5 months ago

Aaroneisele55 commented 5 months ago

The problem

My WLED device goes to "unavailable" at seemingly random intervals, requiring my to powercycle it to get it back to normal state. I only control the device from HA and, sometimes, the WLED mobile app. When it last appeared, I wasn't even home but I noticed it later from the history when it happened

What version of Home Assistant Core has the issue?

core-2024.2.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

WLED

Link to integration documentation on our website

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

Diagnostics information

config_entry-wled-dfde917ad61db3a7986a9243e00d7dec.json

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:240
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 10. Februar 2024 um 05:34:29 (20 occurrences)
Last logged: 08:13:29

[546663089600] Error communicating with WLED API
[546690352960] Error communicating with WLED API
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/wled/wled.py", line 188, in request
    response = await self.session.request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 578, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1101, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1004, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 637, in sock_connect
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/wled/wled.py", line 187, in request
    async with async_timeout.timeout(self.request_timeout):
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 141, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.12/site-packages/async_timeout/__init__.py", line 228, in _do_exit
    raise asyncio.TimeoutError
TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/wled/helpers.py", line 28, in handler
    await func(self, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/wled/select.py", line 99, in async_select_option
    await self.coordinator.wled.preset(preset=option)
  File "/usr/local/lib/python3.12/site-packages/wled/wled.py", line 553, in preset
    await self.request("/json/state", method="POST", data={"ps": preset})
  File "/usr/local/lib/python3.12/site-packages/backoff/_async.py", line 151, in retry
    ret = await target(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/wled/wled.py", line 224, in request
    raise WLEDConnectionTimeoutError(msg) from exception
wled.exceptions.WLEDConnectionTimeoutError: Timeout occurred while connecting to WLED device at 192.168.0.156

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 240, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 195, in async_handle_select_option
    await self.async_select_option(option)
  File "/usr/src/homeassistant/homeassistant/components/wled/helpers.py", line 34, in handler
    raise HomeAssistantError("Error communicating with WLED API") from error
homeassistant.exceptions.HomeAssistantError: Error communicating with WLED API

Additional information

No response

home-assistant[bot] commented 5 months ago

Hey there @frenck, mind taking a look at this issue as it has been labeled with an integration (wled) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `wled` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign wled` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


wled documentation wled source (message by IssueLinks)

Raptylos commented 5 months ago

Hey, I'm having the exact same behaviour. Thank you in advance!

FeromonDE commented 5 months ago

Check your Ping with and without Integration enabled. Its issue with HA 2024.2.

https://www.reddit.com/r/homeassistant/comments/yvi9xz/ha_causing_high_latency_with_wled/

Aaroneisele55 commented 5 months ago

Check your Ping with and without Integration enabled. Its issue with HA 2024.2.

https://www.reddit.com/r/homeassistant/comments/yvi9xz/ha_causing_high_latency_with_wled/

The problem is that the WLED Device somehow crashes, it is completely frozen when the bug happens. Several devices on the network cannot reach the IP, can't ping it... Sadly, I have no options to get logs because if I would connect the ESP's USB Cable for Serial Console to my Laptop, the bug would resolve due to the power cycle. How could I diagnose sich an issue?

smarthomeaf commented 4 months ago

I am having the same issue and I can easily duplicate it. It seems that every time I call I Scene that includes the entities it crashes. All other automations seem to work fine.

smarthomeaf commented 4 months ago

i reverted the WLED firmware back to 0.14.0 and all is good now.. I suggest you check the firmware on your WLED devices and revert back to 0.14.0.

image
Raptylos commented 4 months ago

Thank you @smarthomeaf, that solved the issue for me as well! Great finding

davidarroyo1234 commented 4 months ago

i reverted the WLED firmware back to 0.14.0 and all is good now.. I suggest you check the firmware on your WLED devices and revert back to 0.14.0.

image

Thanks, worked. Hope they fix in next release.

1liminal1 commented 4 months ago

So appears its still happening in 0.14.2-b2? Any update on a fix, this is pretty catastrophic?

1liminal1 commented 4 months ago

I take it back lol, 0.14.2 may have fixed the issue. Seems stable now, how are you guys going with it?

Raptylos commented 4 months ago

I take it back lol, 0.14.2 may have fixed the issue. Seems stable now, how are you guys going with it?

No, on my devices, the lockup occures as well. The only stable version for my devices is 0.14.0

Aaroneisele55 commented 4 months ago

Could anyone test if the newly released 0.15 version fixes this? Unfortunately, I can't test it myself because I have off-the-shelf controllers which are (I assume) difficult to reflash if something goes wrong...

ironcrafter54 commented 3 months ago

Don't quote me on this but I think .15 has fixed it, Ill report back in a few days and let you all know if I encounter any issues.

FeromonDE commented 2 months ago

0.15.0-b2 has fixed this for me.

Aaroneisele55 commented 2 months ago

0.15.0-b2 has fixed this for me.

I have just updated my two Gledopto Controllers to 0.15b2 and I'm now testing if it crashes again...