Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Aug 20, 2024 · 18 comments
Assignees

Comments

@Plawasan
Copy link

Plawasan commented Aug 20, 2024

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 #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
Copy link

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
Copy link
Contributor

Virenbar commented Aug 22, 2024

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
Copy link
Author

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
Copy link
Contributor

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
Copy link
Contributor

Virenbar commented Aug 23, 2024

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

def current_option(self) -> str | None:
"""Return the current selected color palette."""
return self.coordinator.data.palettes[
int(self.coordinator.data.state.segments[self._segment].palette_id)
].name

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
Copy link
Author

Plawasan commented Aug 23, 2024

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

@Virenbar
Copy link
Contributor

I think it's also related to this issue wled/WLED#3841.
Therefore, this error may occur either due to a large number of segments or due to the use of custom palettes.

@rubin110
Copy link

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
Copy link

rubin110 commented Sep 10, 2024

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
Copy link
Author

Plawasan commented Sep 11, 2024

Still the same issue for me on b5.

@rubin110
Copy link

rubin110 commented Sep 11, 2024

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

@javierpal
Copy link

javierpal commented Sep 29, 2024

having the same problem with the b5 update and 0.14.4, the control works but the error appears, and my scripts can't finish because of the errors.

edit: nothing to do with custom palettes.
Edit 2: Didn't read well this post, and the solution is only to deactivate all paletes on the WLed integration, and it worked, but now its having another error after the new OS update

Error fetching wled data: Invalid response from API: (503, {'error': 3})

I can't control anything in wled using scripts, but the direct control works fine.

@rubin110
Copy link

rubin110 commented Nov 2, 2024

WLED 0.15.0-b7
HA 2024.10.4

I'm still seeing this issue crop up. It's intermittent. If I had to guess it's an issue with WLED dropping packets over wifi, and HA not handling that gracefully anymore.

@sotechn
Copy link

sotechn commented Nov 7, 2024

HA: 2024.11.0
WLED: v0.14.4

confirm.
HA marked palettes as obsolete properties.
Deleted all palettes for all segments, automation started working correctly.

upd: after reboot all palettes restored. automation broken now

@rubin110
Copy link

rubin110 commented Nov 25, 2024

HA 2024.11.2
WLED 0.15.0-b7

Curious, are people here running on ESP8266 with the 160MHz clock speed build? I'm pretty sure I've seen it on my ESP32s but can't quite remember now.

Seeing this still crop up. Sadly got home to no lights on. Will give 2024.11.3 a try today.

@sotechn
Copy link

sotechn commented Jan 17, 2025

is there any hope for a fix?
maybe disable syncing palettes?
the component fully doesn't work. 0 automations.

@MABeatty1978
Copy link

b

I'm not aware of a fix, but you can put continue_on_error: true in your action to ignore it.

@sotechn
Copy link

sotechn commented Jan 17, 2025

b

Thank you. I'll try to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants