Automation: How to capture settings/state of one WLED light and apply it to another WLED light on trigger

Hello all. Not sure of the best way to explain this, but here goes an attempt:

I have 2 lights strips, both powered by separate WLED controllers:

WLED Kitchen
WLED Media Cabinet

Currently, in the WLED app, I have Sync set up where WLED Kitchen is the master and WLED Media Cabinet is the slave. So when I perform an action on the WLED Kitchen (toggle on/off, change color, change preset, etc.), the setting is matched in WLED Media Cabinet.

I’m trying to create an automation with 2 triggers:

  1. When my Plex entity changes to “Playing”, the WLED Media Cabinet turns off. I’ve successfully created this trigger and action. So all good there.

  2. When my Plex entity goes to “Idle” or “Paused”, I would like the resulting action to capture the current state of the WLED Kitchen and apply it to the WLED Media Cabinet. This is where I’m running into difficulties.

Any ideas? Thanks!

I’m currently not at home to verify it but could you trigger the switch

switch.WLED name_sync_receive ?

@Thorn thanks for the suggestion. I tried setting the action to switch.wled_mantle_sync_receive but it didn’t do anything. I aslo tried toggling that switch off and then on, thinking maybe it would force the WLED Media Cabinet to check in with WLED Kitchen and then sync to that, but that didn’t do anything either.

You would need to turn off and on the light that has sync enabled for the command to be sent.

I might have found a solution - but it is a little bit strange - it seems that when in a sync group switching off the “responder” Light will not respond if you select the same / current preset again.

My workaround is the following - on the “controller” ligtht copy the preset (so you have two of the same)
UPDATE: to select the new Prset you’ll need to reload the WLED device again

I have a quick automation - which looks like this sorry for the strange device ID names … it is the “controller” light

alias: TestWLED
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.wled_test
    from: "off"
    to: "on"
condition: []
action:
  - device_id: 0cb5eabac36cd0d90de54ab54134a6df
    domain: select
    entity_id: 2f3b0f4006ff371aaaed0023bd0563df
    type: select_option
    option: Pacifica_2
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - device_id: 0cb5eabac36cd0d90de54ab54134a6df
    domain: select
    entity_id: 2f3b0f4006ff371aaaed0023bd0563df
    type: select_option
    option: 01_Pacifica
mode: single

maybe this could be your solution … in my test it worked and switched on the “responder” light with the correct preset.

Thanks again @Thorn. Interesting workaround. The challenge I have is that my “controller” light isn’t always set to a preset. It may just be set to a specific color and brightness level.

For example, if the controller light is set to blue at 50% brightness, I’m looking for the automation to “copy” that state and apply it to the responder light.

I was hopeful that you original suggestion would work (turn on sync receive on the responder). It would be great if that action basically caused the responder to re-sync to the controller, but that doesn’t seem to be the case.

Ok next try - and now it gets wild - as already said the “responder” needs a change from the “controller” to start and recieve data

We will use a rest_command
In your configuaration.yaml add the following

rest_command:
 table_on:
  url: "http://<WLED Controller IP>/win&A=~-1"

with this command we will reduce the brightness by 1 incement (e.g when you are at 50 you’ll end up at 49)

Alternatively you can also toggle the “Controller WLED”

url: "http://<WLED Controller IP>/win&T=1SN=1&A=~-1"

This will turn the “Controller WLED” on set the sync to 1 and reduce Brightness by 1

Complete WLED Documentation on HTTP Request API
https://kno.wled.ge/interfaces/http-api/

In the automation we will call the rest command - this should trigger the “responder” back to life with the current config which “controller” is using

alias: TestWLED
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.wled_test
    from: "off"
    to: "on"
condition: []
action:
  - service: rest_command.table_on
    metadata: {}
    data: {}
mode: single

Let me know if this helped

Hey @Thorn thanks so much for this deeper dive into finding a solution!

So I tried what you suggested (I went with the ‘reduce brightness by 1’ rest command). It worked (awesome!), but I think this solution may be problematic for my use case.

The triggers are
(1) Plex start playing
(2) Plex is paused or stopped (idle)

There’s a condition that checks if the WLED Media Cabinet (Responder) is on or off. If it’s off, no action is taken.

If the Responder is on, when Play is triggered, the Responder dims to 10%.

When Pause is triggered, the Responder should sync with whatever state the WLED Kitchen (Controller) is at (which is typically set to 20%, but not always)

Where I think I may run into an issue is, if the Controller is set to 20% brightness, over the course of a few hours of watching Plex on our Living Room TV, with each press of the Play/Pause button (which occurs a lot in our living room - kids coming in and out, etc.), the brightness of the Controller will slowly but surely start creeping down.

I bet we’ve got evenings where we pause Plex 20-30 times. This would cause the Controller to dim a lot, maybe even turn off completely at some point.

Does that make sense?

I was thinking maybe there was a rest_command that that would trigger a sync, but without actually changing any of the light settings. I looked through the list in the link you provided (HTTP Request API - WLED Project), but I didn’t see anything that I thought might do the trick. Unless, maybe “SN” (Send UDP Notifications") would do that?

What would be great is if there were some way to set something like a variable, or multiple variables, corresponding to the current state of the Controller, and then applying those variables to the responder.

Or even better, some way to just cause the Responder to resync with the Controller.

Thanks again for all of your input!

I believe the solution is quite simple

Add a second rest command

table_on:
  url: "http://<WLED Controller IP>/win&A=~-1"

table_reset:
  url: "http://<WLED Controller IP>/win&A=~+1"


And change your automation to

action:
  - service: rest_command.table_on
    metadata: {}
    data: {}
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - service: rest_command.table_reset
    metadata: {}
    data: {}
mode: single

With this you’ll always end up with the correct brightness

I added the delay to ensure that the controller really gets the additional command - in some cases this causes trouble but in general the delay is not required.

Hi @Thorn I just came back to this thread to post an update that I created a 2nd rest command to push the brightness up by 1… only to find that that is exactly what you suggested. I’m happy to report that it’s working. So thanks for all your help!!

Great that it worked out!