lol, it’s your thread I literally look for any excuse to talk about these things.
I built a script that all it does is handle the randomizer for 1 device:
alias: 'Nanoleaf: Effect Randomizer'
sequence:
- service: light.turn_on
target:
device_id: fc000451bfaf18f9a8f9791cebf0f61a
data:
effect: >-
{{ ["Nanoleaf Aurora Borealis","Nanoleaf Checkerboard","Nanoleaf Cherry
Blossoms","Nanoleaf Chill Vibes Bedroom","Nanoleaf Colored
Snakes","Nanoleaf Dark Northen Lights","Nanoleaf EarthTone","Nanoleaf
Flickering Candle","Nanoleaf Holodek","Nanoleaf JadePalace","Nanoleaf
Purple Sun","Nanoleaf Relaxing neon","Nanoleaf Retro","Nanoleaf Retro
Future","Nanoleaf Scary Night Forest","Nanoleaf Sea of thieves night
s","Nanoleaf Sparrows","Nanoleaf Starry Night","Nanoleaf Sunlight
Through Trees"] | random }}
mode: single
icon: mdi:triforce
You’ll notice that I have several selected scenes using a value template that randomizes just that list.
I have about 5 music scenes and I only want them to be randomized when Sonos is playing music. When music is not playing, select/randomize effects from THIS list (that’s the main reason I have the separation).
Pay no attention to the dumb naming. It was leftover from my Hubitat integration which had a really wonky way to read the effects. Yours would probably be a lot simpler.
For this next part, I have it separated into another script but that’s because I have multiple nanoleafs randomizing different things. You could easily put all this in one
alias: Randomizer Control
sequence:
- service: script.1642351975423
data: {}
- service: script.canvas_effect_randomizer
data: {}
- service: script.shapes_effect_randomizer
data: {}
- service: script.woodleaf_randomizer
data: {}
mode: single
icon: mdi:shape-plus
Whenever this script is triggered, it runs the randomizer script for each of the devices. Again, you can easily combine all this, separating it was best for my needs.
When the house wakes up in the morning, I wake/randomize each of them:
service: light.turn_on
target:
device_id: fc000451bfaf18f9a8f9791cebf0f61a
data:
brightness_pct: 50
effect: >-
{{ ["Nanoleaf Aurora Borealis","Nanoleaf Checkerboard","Nanoleaf Cherry
Blossoms","Nanoleaf Chill Vibes Bedroom","Nanoleaf Colored Snakes","Nanoleaf
Dark Northen Lights","Nanoleaf EarthTone","Nanoleaf Flickering
Candle","Nanoleaf Holodek","Nanoleaf JadePalace","Nanoleaf Purple
Sun","Nanoleaf Relaxing neon","Nanoleaf Retro","Nanoleaf Retro
Future","Nanoleaf Scary Night Forest","Nanoleaf Sea of thieves
nights","Nanoleaf Sparrows","Nanoleaf Starry Night","Nanoleaf Sunlight
Through Trees"] | random }}
Then an automation automatically takes over when the house awake conditions are met throughout the day. Which gives the effect of randomizing the effect every 30 mins as long as the house is awake.
It’s really easy for me to tell if one stops communicating or stops randomizing because nearly every time I walk into a room, the effect should be different:
alias: Nanoleaf Randomizer Control
description: ''
trigger:
- platform: time_pattern
minutes: '30'
condition:
- condition: and
conditions:
- condition: state
entity_id: input_boolean.house_awake
state: 'on'
- condition: time
after: '08:00:00'
before: '21:45:00'
- type: is_open
condition: device
device_id: 253da192a574953187a6ffa226818201
entity_id: binary_sensor.bedroom_2_door_contact_sensor
domain: binary_sensor
- type: is_open
condition: device
device_id: b1c35c134c59dd8979a12b3c488e301e
entity_id: binary_sensor.bedroom_door_contact_sensor
domain: binary_sensor
action:
- service: script.1642351975423
data: {}
- service: script.canvas_effect_randomizer
data: {}
- service: script.shapes_effect_randomizer
data: {}
mode: single
Then I have a set of randomizers just for the music scenes. Automation looks something like: when sonos starts playing, run nanoleaf randomizer script that only contains the music scenes. Other automations that track when sonos stops playing to switch back to non music randomized scenes.
I of course have ridiculous automations that will “change the scene” “alter the mood” as Castor said on Tron and it will randomize the nanoleafs with/without music depending on the command, but all it’s doing it hitting the randomizer button every time it’s triggered
All nanoleafs change to a night effect at night and then eventually turn off when the house goes to sleep.