MyQ garage door and OpenHAB sends me a text and then it I don’t do anything about it, it closes the door for me. It is a bit of a pain if I am in the garage working with the door open. I guess a solution would be to add a motion sensor to check if the garage is occupied and close it only if there is no motion.
The OpenHAB forum is the greatest resource:
https://community.openhab.org/t/how-to-createtimer-and-timer-cancel-when-item-change-state/10781
The openHAB rule that works great for me:
import org.openhab.model.script.actions.Timer
var Timer extended_timer
var EXTENDED_GARAGE_DOOR_TIME_SECONDS = 1200
var Timer unusual_timer
var UNUSUAL_GARAGE_DOOR_OPENED_SECONDS = 3600
rule “Garage Door open for extended period of time sends notification”
when
Item GarageDoorContact changed
then
if (GarageDoorContact.state == OPEN) {
extended_timer = createTimer(now.plusSeconds(EXTENDED_GARAGE_DOOR_TIME_SECONDS)) [|
sendMail(“xxxxxxxxxx@txt.bell.ca”, “Garage Door”, “opened for an extended period”);
]
} else {
if(extended_timer!==null) {
extended_timer.cancel
extended_timer = null
}
}
end
rule “Garage Door open for unusual period of time closes door and sends notification”
when
Item GarageDoorContact changed
then
if (GarageDoorContact.state == OPEN) {
unusual_timer = createTimer(now.plusSeconds(UNUSUAL_GARAGE_DOOR_OPENED_SECONDS)) [|
sendCommand(GarageDoorShutter,DOWN)
sendMail(“xxxxxxxxxx@txt.bell.ca”, “Garage Door”, “Door has been automaticaly closed”);
]
} else {
if(unusual_timer!==null) {
unusual_timer.cancel
unusual_timer = null
}
}
end