Hi,
I have a water detector that can have 3 String values: dry, wet and water.
Now I want to be notified whenever one of them reports wet or water. So I have a group like this:
Group:String:OR(DRY, WET, WATER) gWassermelder <water> (gAll)
And a rule like this:
rule "Water detection 1"
when
Item gWassermelder changed to "WET" or
Item gWassermelder changed to WET or
Item gWassermelder changed to "WATER" or
Item gWassermelder changed to WATER
then
if(vAlarm_Water.state != ON) {
logInfo("RULE", "Wasseralarm ausgelöst!!")
vAlarm_Water.postUpdate(ON)
}
end
rule "Wasseralarm"
when
Item vAlarm_Water changed to ON
then
// Licht an
if(NightState.state == ON && vAusserHaus.state != ON){
sendCommand(gLights, ON)
}
// Benachrichtigungen
var alarm = gWassermelder?.members.filter(s | s.state == "WET" || s.state == "WATER")
if(!(alarm.isEmpty)) {
alarm.forEach[al |
logInfo("RULE", al.label + " hat alarm geschlagen: " + al.state + "!!")
sendBroadcastNotification(al.label + " hat alarm geschlagen: " + al.state + "!!")
]
}
else {
logInfo("RULE", "WASSERALARM!!!")
sendBroadcastNotification("WASSERALARM!!!")
}
end
rule "Wasseralarm OFF"
when
Item gWassermelder changed to "DRY" or
Item gWassermelder changed to DRY
then
if(vAlarm_Water != OFF){
logInfo("RULE", "Wasseralarm ausgeschaltet")
vAlarm_Water.postUpdate(OFF)
}
end
It works with this 1 water detector, but I get his message in the log:
[ERROR] [arthome.core.items.dto.ItemDTOMapper] - Group function 'OR' requires two arguments. Using Equality instead.
So I wonder what will happen if I have 2 waterdetectors reporting different values. According to Docs it will get “UNDEF” what won’t help me.
And how I can get rid of this error. I tried already:
Group:String:EQUAL(DRY, WET, WATER)
but it throws an error in the designer.
Thanks and regards
Viktor