It’s been a long time now I’ve been looking for this and I can’t figure out how to achieve this.
I currently run a script every evening that decreases my lights brightness every 5 mins until they’re all “off” and I like that my living room slowly dims the light off at bedtime.
I’ve already set the bedtime as a parameter using time helper.
The point is I had currently hardcoded the script with all the light concerned, it works but I’m feeling bad about the way I achieve this. I don’t like the idea I would need to modify the script every time I Add/Remove a light in the living room, or that I should do another script for any room I’d want to replicate this behavior.
I’d like to modify this script like receiving a group/room as an input so it goes like :
var group = !input light_group
repeat:
Foreach light in group:
light->decrease_brightness
end foreach
until group is off
Any idea how I could script this in a elegant way ?
Don’t pay attention to the last action, I have a light strip on a connected plug so I just turn it off once every light is off. But this has nothing to do with my purpose of iterate the decrease_brightness through a group of light.
And yep you’re right I made those scripts with the script integration “UI” but I don’t mind going with YAML script. I’m not just very familiar with the YAML script syntax yet, especially when it comes to template.