Group function OR with 3 values

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

I think you are misinterpreting what the OR part of the Group definition means.

The following:

Group:Switch:OR(ON,OFF)

Means if any one of the Switches is ON, the Group’s state is ON otherwise the Group’s state is OFF.

It makes no sense to have an OR function that has three arguments.

For EQUALS:

Group:String:EQUALS("WET")

Means that if all members of the Group equal “WET” then the Group’s state is “WET” otherwise it is UNDEF.

You cannot do this in a Group.

Unless this has been fixed, changed to only works with Switches and Contacts right now. It won’t work with String Items.

To achieve what you want to you must get rid of the function part of the Group:

Group:String gWassermelder <water> (gAll)

And change your rule to:

rule "Water detection 1"
when
    Item gWassermelder received update
then
    var numWetWater = qWassermelder.members.filter[s|s.state.toString == "WET" || s.state.toString == "WATER"].size
    if(numWetWater > 0 && vAlarm_Water.state != ON) {
        logInfo("RULE", "Wasseralarm ausgelöst!!")
        vAlarm_Water.postUpdate(ON)
    }
end

Hi Rich,

OK I think I understand, thank you very much! Your way works perfectly.

Cheers
Viktor