Rule condition strangly not accepted

Hello openHAB community!
I’m a beginner with openHAB and ran into a problem which seems like a bug but is probably something I’m doing wrong… :o)

I am trying to react on one door being opened (HM-Sec-SCo).

My rule is more complex, minimal example:

rule "Badtuer"
      Item BD_Tuer_State changed
then {
    logInfo ("FILE", "Bad: Türsensor ausgelöst: " + BD_Tuer_State.state)
    if (BD_Tuer_State.state == OPEN) {
        logInfo ("FILE", "Bad: Türsensor ausgelöst beim Öffnen.")


2016-02-07 19:19:48 - BD_Tuer_LowBat state updated to OFF
2016-02-07 19:19:48 - BD_Tuer_State state updated to true
2016-02-07 19:19:50 - BD_Tuer_LowBat state updated to OFF
2016-02-07 19:19:50 - BD_Tuer_State state updated to false


2016-02-07 19:19:49.110 [INFO ] [org.openhab.model.script.FILE ] - Bad: Türsensor ausgelöst: true
2016-02-07 19:19:50.707 [INFO ] [org.openhab.model.script.FILE ] - Bad: Türsensor ausgelöst: false

As you can see, I am not getting past the point of checking the state. I tried comparing with 1/true/ON as well without success - even though the state clearly switches to true.

The following rule conditon is even worse. The rule is not executed at all:

Item BD_Tuer_State changed from CLOSED to OPEN

On a logical level, everything seems correct, what am I doing wrong?

Thanks! Thomas

(System: RPi2 + homegear + openhab 1.8.1)

Got it :sweat_smile:
Wanted to include the item definition and instead of “Contact” it was a “String” Element.

For whoever finds this: thread: check your item type.