Glad you got it!
Couple of bits, because your else clause doesn’t have a test, the switch could be turned off if OH restarts or the item file is updated so I have added the first line.
Also because your proxy item doesn’t have a binding, a postUpdate
in sufficient.
Finally because the item MainDoorSensor
is a Contact Item, OPEN is a valid state so you don’t need the toString and the quotes in your if statement.
//Garage Door Sensor Dummy rule
rule “Manual: Set Door Sensor Dummy to true Door Sensor position”
when
Item MainDoorSensor changed
then
if (MainDoorSensor.state == NULL) return; // Avoid running the rule on restart or update of item file
if (MainDoorSensor.state == OPEN) {
logInfo("org.openhab.rules","Changing Main Garage dummy sensor to open because real sensor is open")
MainDoorSensorDummy.postUpdate(ON)
} else {
logInfo("org.openhab.rules","Changing Main Garage dummy sensor to open because real sensor is closed")
MainDoorSensorDummy.postUpdate(OFF)
}
end
Last but not least, when publishing code, please use the codes fences, thanks.