How to get contact sensor to read open when closed and vice versa

(Spec) #1

I am using Jit Jacks code for my garage door and sensor. Everything is working perfectly. I am new to coding, can any one advise on what I need to do to have the sensor read closed when open and open when closed. I a hard wired plunger contact sensor that sits in the track and the wheel on the track closes the circuit when the door is fully opened. iIt’s not meant for security just to know if it is left open. Can someone help and let me know what I need to do to have the tiles show open when it is actually closed and vice versa. I thought it would be simple but nothing is working.

Continuing the discussion from Working MIMOlite Device Type with Sensor:

(Cooper Lee) #2

the tile is an actual representation of the “state” so - not so easy to inverse them… you can create an additional attribute (and another tile) in the device type called garage_door or something and “flip” it open/closed as you choose from the state of the contact sensor…

attribute “garage_door”, “enum”, [“open”, “closed”, “opening”, “closing” ]

def open() {
sendEvent([name: “garage_door”, value: “closed”])

def close() {
sendEvent([name: “garage_door”, value: “open”])