Hi, I have a light strip (wled) in my sons room. I’d like to set it up so it changes colour every time it is turned on. Is anyone able to point me in the right direction? Input select maybe?
this is what I use build it long time ago
I set them up so the MQTT and the lights have the same name
wled_board:
options:
- all
- xtree
- string
initial: all
now the script
wled_random_xtree:
alias: Randomise WLED
sequence:
- service: mqtt.publish
data_template:
topic: wled/{{ states("input_select.wled_board") }}/api
payload: '{{ [''[FX=00] Solid'',''[FX=01] Blink'',''[FX=02] Breathe'',''[FX=03]
Wipe'',''[FX=04] Wipe Random'',''[FX=05] Random Colors'',''[FX=06] Sweep'',''[FX=07]
Dynamic'',''[FX=08] Colorloop'',''[FX=09] Rainbow'',''[FX=10] Scan'',''[FX=11]
Dual Scan'',''[FX=12] Fade'',''[FX=13] Chase'',''[FX=14] Chase Rainbow'',''[FX=15]
Running'',''[FX=16] Saw'',''[FX=17] Twinkle'',''[FX=18] Dissolve'',''[FX=19]
Dissolve Rnd'',''[FX=20] Sparkle'',''[FX=21] Dark Sparkle'',''[FX=22] Sparkle+'',''[FX=23]
Strobe'',''[FX=24] Strobe Rainbow'',''[FX=25] Mega Strobe'',''[FX=26] Blink
Rainbow'',''[FX=27] Android'',''[FX=28] Chase'',''[FX=29] Chase Random'',''[FX=30]
Chase Rainbow'',''[FX=31] Chase Flash'',''[FX=32] Chase Flash Rnd'',''[FX=33]
Rainbow Runner'',''[FX=34] Colorful'',''[FX=35] Traffic Light'',''[FX=36]
Sweep Random'',''[FX=37] Running 2'',''[FX=38] Red & Blue'',''[FX=39] Stream'',''[FX=40]
Scanner'',''[FX=41] Lighthouse'',''[FX=42] Fireworks'',''[FX=43] Rain'',''[FX=44]
Merry Christmas'',''[FX=45] Fire Flicker'',''[FX=46] Gradient'',''[FX=47]
Loading'',''[FX=48] In Out'',''[FX=49] In In'',''[FX=50] Out Out'',''[FX=51]
Out In'',''[FX=52] Circus'',''[FX=53] Halloween'',''[FX=54] Tri Chase'',''[FX=55]
Tri Wipe'',''[FX=56] Tri Fade'',''[FX=57] Lightning'',''[FX=58] ICU'',''[FX=59]
Multi Comet'',''[FX=60] Dual Scanner'',''[FX=61] Stream 2'',''[FX=62] Oscillate'',''[FX=63]
Pride 2015'',''[FX=64] Juggle'',''[FX=65] Palette'',''[FX=66] Fire 2012'',''[FX=67]
Colorwaves'',''[FX=68] BPM'',''[FX=69] Fill Noise'',''[FX=70] Noise 1'',''[FX=71]
Noise 2'',''[FX=72] Noise 3'',''[FX=73] Noise 4'',''[FX=74] Colortwinkle'',''[FX=75]
Lake'',''[FX=76] Meteor'',''[FX=77] Smooth Meteor'',''[FX=78] Railway'',''[FX=79]
Ripple'',''[FX=80] Twinklefox'',''[FX=81] Twinklecat'',''[FX=82] Halloween
Eyes'']|random }}'
- service: mqtt.publish
data_template:
topic: wled/{{ states("input_select.wled_board") }}/api
payload: '{{ [''[FP=00] Default'',''[FP=01] Random Cycle'',''[FP=02] Primary
color'',''[FP=03] Based on primary'',''[FP=04] Set colors'',''[FP=05] Based
on set'',''[FP=06] Party'',''[FP=07] Cloud'',''[FP=08] Lava'',''[FP=09] Ocean'',''[FP=10]
Forest'',''[FP=11] Rainbow'',''[FP=12] Rainbow bands'',''[FP=13] Sunset'',''[FP=14]
Rivendell'',''[FP=15] Breeze'',''[FP=16] Red & Blue'',''[FP=17] Yellowout'',''[FP=18]
Analoguous'',''[FP=19] Splash'',''[FP=20] Pastel'',''[FP=21] Sunset 2'',''[FP=22]
Beech'',''[FP=23] Vintage'',''[FP=24] Departure'',''[FP=25] Landscape'',''[FP=26]
Beach'',''[FP=27] Sherbet'',''[FP=28] Hult'',''[FP=29] Hult 64'',''[FP=30]
Drywet'',''[FP=31] Jul'',''[FP=32] Grintage'',''[FP=33] Rewhi'',''[FP=34]
Tertiary'',''[FP=35] Fire'',''[FP=36] Icefire'',''[FP=37] Cyane'',''[FP=38]
Light Pink'',''[FP=39] Autumn'',''[FP=40] Magenta'']|random }}'
- service: mqtt.publish
data_template:
topic: wled/{{ states("input_select.wled_board") }}/api
payload: SX={{ (range(0, 255)|random) }}
note the topic points to the input_select
have a time time select
xled_time:
name: XLED Ramdom Time Change
options:
- '01'
- '02'
- '03'
- '04'
- '05'
- '10'
- '15'
- '20'
- '25'
- '30'
- '40'
- '50'
- '60'
the script that run it
ramdom_xtree_lights:
alias: Ramdom WLED lights Start
sequence:
- service: light.turn_on
data_template:
entity_id: light.wled_{{ states("input_select.wled_board") }}
- service: script.turn_on
data_template:
entity_id: script.wled_random_xtree
- delay: 00:{{ states.input_select.xled_time.state }}:00
- service: script.turn_off
data:
entity_id: script.wled_random_xtree
- service: script.turn_on
data:
entity_id: script.flash_loop_xtree
the script that loops it
flash_loop_xtree:
alias: flash loop xtree
sequence:
- delay:
seconds: 1
- service: script.turn_on
data:
entity_id: script.ramdom_xtree_lights
and the script that STOP it
stop_flash_xtree_lights:
alias: Stop Flash WLED Lights
sequence:
- service: script.turn_off
data:
entity_id: script.ramdom_xtree_lights
- service: light.turn_off
data_template:
entity_id: light.wled_{{ states("input_select.wled_board") }}
there could be a beater way of doing it the Xtree lights LED I on the tree in 2018
so its just grown in time
also wanted to lean data_template: changing bits of the line
ie
data_template:
entity_id: light.wled_{{ states("input_select.wled_board") }}