Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
15.07k stars 3.26k forks source link

Preset turning off when turning off light #4240

Open finity69x2 opened 3 weeks ago

finity69x2 commented 3 weeks ago

What happened?

If I go to the dashboard and select a preset then turn on light everything is good

but when I turn the light off the preset gets deselected.

this happens from the WLED dashboard and in home assistant

this really screwed up my home assistant automation since I use the preset selection to control automations.

To Reproduce Bug

select a preset turn on light turn off light preset gets deselected and shows as unknown in home assistant

Expected Behavior

the last preset should stay selected when light is off

Install Method

Self-Compiled

What version of WLED?

0.14.4 and 0.15.0-b7

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

it worked as expected in some previous version of WLED. I was forced to update to 0.14.4 as the minimum version when updating home assistant. I'm pretty sure that it worked as expected in version 0.13.3.

Code of Conduct

DedeHai commented 3 weeks ago

what do you mean by "preset gets deselected" ? when you turn off the leds, the preset just gets paused, it is not unloaded. this looks like a problem on HA side to me.

finity69x2 commented 2 weeks ago

It's not a HA thing.

it happens whether it's controlled from HA or from the WLED control panel.

here's gif to show what's happening:

WLED

as you can see when I start out that the preset in both HA and WLED shows as 'yellow'.

I then turn off the light from WLED and the 'yellow' preset turns off in WLED and the preset in HA goes to 'unknown'.

but you are correct that WLED does remember the preset somewhere because if the light gets turned back on from either HA or WLED the color is still yellow from the last preset selected.

it just doesn't indicate anywhere that I can see that it's the case.

DedeHai commented 2 weeks ago

I see. what parameter is that you are reading from wled that gets disabled?

finity69x2 commented 2 weeks ago

I'm not sure I understand the question...

the preset gets disabled in both HA and WLED.

I don't know how HA determines what the preset is but that is a built-in function that HA reads from WLED. Once the preset gets turned off in WLED (or whatever is happening) then HA just reflects that.

If that's not what you are asking then could you please clarify?

DedeHai commented 2 weeks ago

the question is how does it determine that it is not selected, i.e. what "value" or parameter is requested from WLED.

netmindz commented 2 weeks ago

Looks more like a feature not a bug. If you are turned off then by very definition surely there is no actively running preset? Did any version behave differently? If so which version of WLED worked as you expect?

With regards to automations, please can you explain this a little further

finity69x2 commented 2 weeks ago

as you can see at the beginning of the gif sequence above the 'yellow' preset is selected. it is the one that's highlighted.

and in HA it shows as 'yellow'.

once the light is turned on or off the preset in WLED gets unhighlighted (deselected) and the preset in HA goes to unknown.

it doesn't get re-selected if the light is turned back on either.

here is another gif example but using the white preset instead of yellow:

WLED_3

as you can see HA is simply reporting what WLED is doing.

And I can then re-select the preset in HA and it shows as selected in WLED.

I'm pretty positive that this didn't happen in my previously installed version of WLED (0.13.3). it only started when I updated to 0.14. as a requirement for HA to support WLED.

finity69x2 commented 2 weeks ago

to answer more directly the questions...

i.e. what "value" or parameter is requested from WLED.

I have no idea what HA is looking at in WLED. I'm not a coder so I'm not sure I could even find it in the code if I tried.

But whatever it is even WLED itself doesn't indicate that the preset is selected once the light is turned on so, again, I don't think it's a HA problem.

If you are turned off then by very definition surely there is no actively running preset?

But that doesn't seem to be the case because I can select the preset from either HA or within WLED and the preset is indicated correctly in both places even if the light itself is actually off. This behavior can be seen in the gif above.

in the beginning of the sequence the light is off but the preset shows "white" in both places.

it only gets set to either 'unknown' in HA or deselected in WLED once the light is actually turned on.

and if the light gets turned back on the the preset stays 'unknown' or deselected.

With regards to automations, please can you explain this a little further

If I have an automation that checks that the correct preset is selected it will fail if the preset is unknown. Even if the correct preset was previously selected as soon as the light is turned on or off it goes to unknown.

or if I select a preset and then turn on the light the preset goes back to unknown.

I've had an automation fail to actually select the desired preset because of this bug where it had actually worked before.

I could try to replicate the correct results in HA but since now the minimum version that's supported in HA is 0.14.x then there's no way I can revert to an older version of WLED.