Rule exception while formatting value

  • Platform information:
    • Hardware: RasspberyPI 3+
    • OS: openhabian
    • openHAB version: OH3

I have rule, that checks if the state of group item has changed and if group item is OPEN or CLOSED. I am getting error when the rule is executed:

Exception while formatting value ‘OPEN’ of item gMotionSensors

my rule:

rule “Motion detected”
when
Item gMotionSensors changed
then
if (gMotionSensors.state != OPEN) {
MotionAlarm.sendCommand(OFF);
} else {
MotionAlarm.sendCommand(ON);
}
end

May we see the complete WARN message?
I don’t think this has anything to do with a rule; your UI probably is updating as well when the group state changes?

Error message in openhab.log:

Exception while formatting value ‘OPEN’ of item gMotionSensors with format ‘(%d)’: d != java.lang.String

Alright, what is the state description of your Item? How that might be set or omitted depends on how you defined it.

Item configuration in items folder:

Group:Contact:OR(OPEN, CLOSED) gMotionSensors “Motion Sensors [(%d)]” (Doma)

You can’t format states OPEN and CLOSE with %d
%s will work.

In OH2, %d had a magic special case for Switch andContact type Groups of producing a count of matching Items.
I don’t think magic %d is available in OH3.

Thanks, %s worked.