[SOLVED] Rule syntax error?

Hi All

I see this error in the following rule, it doesnt like ‘garage’

21:52:39.406 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Blue Iris Motion Detection Alert - Garage': The name 'Garage' cannot be resolved to an item or type; line 145, column 32, length 6



rule "Blue Iris Motion Detection Alert - Garage"
when
    Item Motion_Garage received command
then
     if(Kris_MobileAP.state != Garage || Jodie_MobileAP.state != Garage){
         logInfo("Blue Iris", "There is motion in the Garage")
           Echo_Living_Room_TTS.sendCommand('There is motion in the Garage')
           Echo_Garage_TTS.sendCommand('The police have been called')
        sendBroadcastNotification("There is motion in the Garage")
}
end


Garage is a valid state…


openhab> smarthome:status Kris_MobileAP
UNDEF
openhab>

Not sure what I;'m doing wrong. Any suggestions?

Thanks!

You need to use quotes on the “Garage” state, it’s a custom string.

So, change:

if(Kris_MobileAP.state != Garage && Jodie_MobileAP.state != Garage){

to

if(Kris_MobileAP.state != “Garage” && Jodie_MobileAP.state != “Garage”){

Ah! So only ON, OFF, OPEN, CLOSED etc can be used without quotes. Thanks Alpoy!

Yepp :slight_smile:

1 Like

Yes, these are commands defined in the DSL
A color item accepts ON, OFF INCREASE, DECREASE
Contact - OPEN, CLOSED
Dimmer same as color
Player - PLAY, PAUSE, REWIND, FASTFORWARD, NEXT, PREVIOUS
Rollershutter - UP, DOWN, STOP, MOVE
Switch - ON, OFF

See: https://www.openhab.org/docs/configuration/items.html#type