This rule will always say its closed, even if its open, despite the state of the contact being correct.
I’ve traced it to this piece, which when if changed to state == “OPEN” , as opposed to without “”, it works just fine.
Some doors in the home, will show OPEN, some will show ON, so I convert them with transform maps.
Here is the rule
import org.openhab.core.types.State rule "Keep track of the last time a door was opened or closed" when Member of gDoorSensors changed then if(previousState == NULL) return; val name = triggeringItem.name val state = triggeringItem.state // Update the time stamp postUpdate(name+"_LastUpdate", now.toString) // Set the timer if the door is open, cancel if it is closed if(state == OPEN || state == ON) sendCommand(name+"_Timer", "ON") else postUpdate(name+"_Timer", "OFF") // Set the message val msg = new StringBuilder msg.append(transform("MAP", "en.map", name) + " was ") msg.append(if(state == OPEN) "opened" else "closed") <----- THIS IS THE PROBLEM AREA!
So basically, if I change OPEN to “OPEN” the front door will message alert correctly, but the rear door says its closed when its open. If I change it to OPEN, without “”, the rear gate works fine, but the front door wont work!
How bizzare. Can anyone see what I’m doing wrong?