I’m trying to build a rule for presets in my living room. I have a Switch with 3 options: all off, all on, or mood lighting.
I want the mood preset to turn off all lights in the living room, except the ones that are mood lights, and turn those on if they are off
I defined my items and groups like this (pseudo):
Group li
Group li_mood (li)
Switch li_light1 (li)
Switch li_light2 (li_mood)
Switch li_light3 (li_mood)
Is it possible in the rules to do something like this? It doesn’t seem to work for me:
rule "Living room preset - Mood"
when
Item li_preset changed to 2
then
li.allMembers.filter(i | !li_mood.contains(i)).send(OFF)
li_mood.send(ON)
end
I’d prefer doing the presets this way, because it doesn’t require me to change the rules every time I should add or remove items. I could do it by switching off all the lights first and then turning on the mood lights, but that means I would be in the dark for a little while when going from “on” to “mood”.