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
71.13k stars 29.8k forks source link

WLED 0.15.0-b4 on ESP02: Failed to perform the action light/turn_on. Invalid response from WLED API (however works OK) #124323

Open Plawasan opened 3 weeks ago

Plawasan commented 3 weeks ago

The problem

Not sure if this goes here or to WLED..

I'm running WLED 0.15.0-b4 on an ESP02 (Athom controller). The device works OK however generates errors on every action, both in the UI and in logs.

image

This is also my only device (rest are ESP32 based or run different WLED version) that was affected by https://github.com/home-assistant/core/issues/123506

A different instance of the same HW running WLED 0.14.4 is not affected by this issue, i.e. no errors, another device that runs the same WLED version but is ESP32 based is also OK.

What version of Home Assistant Core has the issue?

core-2024.8.2

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

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant
Source: components/wled/select.py:180
First occurred: 8:13:42 PM (4 occurrences)
Last logged: 8:14:11 PM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/wled/coordinator.py", line 79, in listen
    await self.wled.listen(callback=self.async_set_updated_data)
  File "/usr/local/lib/python3.12/site-packages/wled/wled.py", line 123, in listen
    callback(device)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 489, in async_set_updated_data
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 533, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 145, in state
    current_option = self.current_option
                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wled/select.py", line 180, in current_option
    return self.coordinator.data.palettes[
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 0

(also seeing a lot of these empty log entries)
Logger: homeassistant.components.wled
Source: components/wled/coordinator.py:86
integration: WLED (documentation, issues)
First occurred: August 18, 2024 at 9:35:00 PM (17 occurrences)
Last logged: 5:44:40 PM

Additional information

Firmware: 0.15.0-b4 Hardware: esp02

home-assistant[bot] commented 3 weeks 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)

Virenbar commented 3 weeks ago

I have 3 WLEDs on esp8266 and with one of them the same error occurs. The WLED with the error differs only in having custom palettes, and the error only occurs when custom palette is selected. When the standard palette is selected, the errors stop occurring.

chrome_2024-08-23_00-38-35

Plawasan commented 3 weeks ago

I checked and not a single one of the presets created on this device is using a custom palette, it's mostly Solid effect without a palette or default palette where one is used.

wled_presets_WLED-LR-Shelves.json

Virenbar commented 3 weeks ago

Then there might be more than one reason for this error. But my logs are slightly different, and the occurrences counter increases every 10 seconds.

Logger: homeassistant
Source: components/wled/select.py:180
First occurred: 22 августа 2024 г. в 23:09:36 (633  occurrences)
Last logged: 01:09:46

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 533, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
    self.__async_calculate_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 145, in state
    current_option = self.current_option
                     ^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/wled/select.py", line 180, in current_option
    return self.coordinator.data.palettes[
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 255
Virenbar commented 2 weeks ago

I looked at the api(http://[WLED-IP]/json) and the code.

https://github.com/home-assistant/core/blob/4e94ce0cc7f76cb3c0eec2c68819b199878127fb/homeassistant/components/wled/select.py#L178-L182

As I understand this property uses the palette id to find it in the palette list, but the WLED api doesn't have custom palettes in the palette list. I tried disabling the select.[name]_color_palette entity and the error stopped occurring. So in my case as a workaround it is possible to temporarily disable this entity.

Plawasan commented 2 weeks ago

Can confirm, disabling the palette entities (6 in my case since I have multiple segments) stops the error from occurring.

Virenbar commented 2 weeks ago

I think it's also related to this issue https://github.com/Aircoookie/WLED/issues/3841. Therefore, this error may occur either due to a large number of segments or due to the use of custom palettes.

rubin110 commented 2 days ago

I'm also hitting this issue. I don't have any custom pallets (I honestly have never created one since starting to use WLED). The work around of Disabling the pallet entity works for me too.

rubin110 commented 2 days ago

Just updated WLED to 0.15.0-b5 which was released literally around the same time I made that last comment.

I'm waiting for a few automations to run that wiggle around WLED and see if the issue comes back.

Plawasan commented 1 day ago

Still the same issue for me on b5.

rubin110 commented 1 day ago

Yup the issue has returned for me too. I'm not sure if it was from a restart of HA or something else.