Set scenes of WLED esp32 controller

Hi,

I have an ESP32 running WLED firmware 0.14. What I want to do is control 3 ledstrips in total. Ledstrip 1&2 are 24v (PWM White) ledstrips connected to 2 PWM boards on pins 4 & 1, ledstrip 3 is a WS821X strip connected to gpio 16.

Everything works as it should from the WLED webinterface. I can dim/control the three segments separately without problems.

Controlling them from HA fails however: I want to define 3 scenes to set the brightness to 30% - 60% - 100% respectively. However this fails
Configuring the scene I select the entity, for example a 24v led strip (wled segment 1), I set the brightnes and when clicking I see the leds changing brightness as I choose the correct brightness. The moment I click ‘save’, for example at full birghtness, the LEDs go out. Calling the scene does nothing anymore. Only by going to the WLED webinterface I can enable the led strip again. Until I activate the scene (full brightness) and the leds go out again.

Not sure what I’m doing wrong???

Best regards,
Jan
(running latest dev release of HA)

Can you post the yaml for your scene here please?

Hi Tom,
Here you go:

- id: '1700505371608'
  name: BathroomLedStrip1High
  entities:
    light.wled_segment_1:
      effect_list:
      - Akemi
      - Android
      - ....... //I Removed the complete effectlists for clarity. 
      - Wavesins
      - Waving Cell
      - Wipe
      - Wipe Random
      supported_color_modes:
      - rgb
      color_mode: rgb
      brightness: 255
      hs_color:
      - 0
      - 0
      rgb_color:
      - 255
      - 255
      - 255
      xy_color:
      - 0.323
      - 0.329
      effect: Solid
      icon: mdi:led-strip-variant
      friendly_name: WLED Segment 1
      supported_features: 36
      state: 'on'
  icon: mdi:vanity-light
  metadata:
    light.wled_segment_1:
      entity_only: true

In the WLED webinterface I see the following segments:

  • Segment 0: a pwm white led strip.
  • Segment 1: a second pwm white led strip
  • Segment 2: : an rgb ledstrip.

In HA I see a couple of entities:

  • Main: I presume this controls all lights
  • Segment 1: maps to Wled segment 1
  • Segment 2: maps to Wled segment 0
  • wled: maps to Wled segment 2

I noticed in WLED each white PWM segment has it’s own slider, plus there is a ‘global’ brightness slider. When I set the dedicated slider of a segment or the brightness slider to 50% in WLED, I notice that when I configure the scene in HA I can only set the brightness between 0% and 50% (the HA slider goes to 100%, but I can only set half brightness). But once I save the scene, the ledstrips goes out.

Best regards,
Jan

To simplify things I removed 2 ledstrips and kept one PWM White ledstrip on pin 4 of my ESP32. It stil doesn’t work on WLED 0.14. I reflashed to 13.3 but same problem.

I have to enable the ledstrip through WLED, then in the scene config screen in HA I can configure the ledstrip, set the brightness and save it. When I click the back arrow next to the scene name, the ledstrip powers down and I can’t control it anymore from HA. Going into the scene config screen and trying setting the brightness does not work. Only from WLED I can control the ledstrip at that point.

Have you tried creating a scene manually using yaml?

Only specify the states you want to change for the light. Not all that extra unnecessary data that may be flooding the controller with requests.

scene:
  - name: test
    entities:
      light.your_lught_here:
        state: "on"
        brightness: 200

Hi,

thank you for your reply. It now works… sort of.
I re-added the second white channel ledstrip and can control the 2 strips individually from HA using scenes by adding the segments manually, BUT I need to manually adjust the Fx slider (called white channel in the 0.13.3 release. I since reflashed WLED to the latest 0.14 release.)

The problem is that the Fx slider is set to 0% by default when the WLED board reboots. So I manually need to set that to 100% using the WLED webinterface, and then the HA control works. (If I set the Fx slider to 50%, I can only control between 0% and 50% by setting the brightness between 0% and 100%).

The entity ‘bathroom_main’ brightness setting controls all segments.
The enity ‘bathroom’ brightness controls Ledstrip 1 (segment0 in WLED).
The entity ‘bathroom_segment1’ brightness controls Ledstrip 2 (segment1 in WLED).
But how do I control the Fx slider? I see no entity for that? There is such a slider for each segment in WLED.

Best regards,
Jan

I believe that is the “intensity” number entity.

I already tried that. If the intensity (fx slider) is set to 0 in WLED (after reboot for example) and I set both the brightness and intensity to 255 in HA the ledstrip doesn’t light up. Only changing the fx slider in WLED changes things. I can see the brightness slider move in WLED when I change the brightness from HA. The FX slider doesn’t budge if I change the intensity setting in HA.

I tried the following when the brightness was set to 255:

  • The FX slider is at zero in WLED, and I change it to 255 from WLED. => ledstrip lights up full brightness, but nothing in the intensity logs in HA and the slider there doesn’t move (stays at zero).
  • I change the FX slider to zero again => ledstrip turns off, nothing in the HA log.
  • I change the intensity slider in HA from 0 to 255 => entry in the logs in HA, ledstrip stays off, FX slider doesn’t move.
  • I change the intensity slider in HA to 0 again => entry in the logs in HA, nothing else.
  • Slider in HA from to 255 again => entry in the logs in HA, ledstrip stays off, FX slider doesn’t move.

I tried deleting the WLED device a couple of times from HA and re-adding it, but that didn’t help.

Ok, it can’t work with setting the ‘intensity’ => that refers to the effect intensity.

That would be a bug then. You can open a new issue here:

Wel, the thing is that the ‘intensity’-entity in HA refers to the effect-entity, next to the ‘speed’-entity for the effect you have chosen. In my case I don’t want to use effects, just a solid color (white) that I can dim.
So I think the question is: is the fx slider entity missing in the WLED integration? Or does WLED not provide it?

I now also enabled MQTT on my WLED and looked at the messages it sends out using MQTT Explorer.

Moving the FX or white channel slider is represented in the following XML file as ‘wv’ (white value). It’s this value I believe that should be in the WLED integration but is lacking.

In the following XML you can see I set the slider to 139, which is represented by <wv>139</wv>

<?xml version="1.0" ?><vs><ac>255</ac><cl>255</cl><cl>160</cl><cl>0</cl><cs>0</cs><cs>0</cs><cs>0</cs><ns>0</ns><nr>1</nr><nl>0</nl><nf>1</nf><nd>60</nd><nt>0</nt><fx>0</fx><sx>128</sx><ix>128</ix><fp>2</fp><wv>139</wv><ws>0</ws><ps>0</ps><cy>0</cy><ds>BadkamerWled13.3</ds><ss>0</ss></vs>

Made a bit more progress using a workaround:

I have it working by setting the ‘FX Slider’ to the maximum for every segment, save all segment settings to a preset in WLED, and have that preset be the default at boot.

Then I defined the scenes like this:

- name: BadkamerBovenLed1-High
  entities:
    light.badkamerwled:
      state: "on"
      brightness: 255
    light.badkamerwled_main:
      state: "on"
      brightness: 255
- name: BadkamerBovenLed1-Medium
  entities:
    light.badkamerwled:
      state: "on"
      brightness: 90
    light.badkamerwled_main:
      state: "on"
      brightness: 255
- name: BadkamerBovenLed1-Low
  entities:
    light.badkamerwled:
      state: "on"
      brightness: 5
    light.badkamerwled_main:
      state: "on"
      brightness: 255
- name: BadkamerBovenLed1-Off
  entities:
    light.badkamerwled:
      state: "off"
      brightness: 255
    light.badkamerwled_main:
      state: "on"
      brightness: 255

You need to put the ‘main light’ to full brightness every time as well, even if you turn off one segment (otherwise other segments might turn off that were on). When I added the WLEDcontroller to HA I chose not to include the ‘main’ light, but HA seems to add it anyway (this is only asked when you have more than 1 segment on WLED).

However, this seems like a workaround for me. In Home Assistant I have a color palette entity, but on the WLED interface it states “color palette not used”.

WLEDFX

So I wonder: is it WLED that is not providing the necessary API to let the FX slider be controlled remotely? Or is it a problem with the Home Assistant integration?