Hell,
not very clear the topic…
I have a Group with WindowContacts, which diplays the SUmm of all contacts:
Group:Contact:OR(OPEN, CLOSED) Fensterkontakte “Offene Fenster [(%d)]” (All)
This is working, at least with one contact (till now I have only one). So it displays “(1)” or “(0)”.
Now I want to switch on a lamp, when there is no “(0)”, means, at least one window is open.
rule "Warn on Window open with flashing Laser"
when
Item Fensterkontakte changed
then
if(Fensterkontakte.state != 0) {
LaserCommand.sendCommand(“ON”)
}
else {
LaserCommand.sendCommand(“OFF”)
}
end
The if-clause is not working correctly, because when the contact is triggered, allways the next line “LaserCommand.sendCommand(“ON”)” is fired. So, what must be the syntax of the if-clause to check for the Number/state/count of the Group?
Thanks…
p.s.: not important, but for integrety:
String LaserCommand “[%s]” {mqtt=">[broker:haus/HWR/Fenster/Laserwarnung:command:*:default]"}
The String (comand) on MQTT is send correctly, I see it in MQTT.fx