Using 2.4 stable, rules DSL and trying to send only the OFF command to items that are on. This is due to the fact there are so many lights that sending off commands to items already OFF seems pointless and a poor design.
So I have this rule, but in the karaf console I see OFF commands sent to all devices.
rule "Turn off All Lights"
when
Item gAllLights received command OFF
then
gAllLights?.members.filter[Lights | Lights.state==ON].forEach[ LightsON |
LightsON.sendCommand(OFF)
]
end
The group is a switch:OR(ON,OFF)
I can’t see an issue with this rule but clearly something is wrong. The original post was here, where rossko helped and this is the same setup
When a command is sent to a group, it will be passed on to all members of the group. One way around this is to use a proxy Item and trigger the rule off of that Item. You also may be interested in this…
In this case the unwanted OFF commands on items that are alreadys OFF would have been sent even WITHOUT the rule. IMHO the question is how did the Group get this command.