Creating Rules for MyQ Control


#1

I set up the MyQ with the help of the guide and have one question that would be a huge benefit to me and keep me out of the doghouse with the wife.

See, I have a bad habit of leaving the garage door up all the time. It’s not a huge deal since we have a fully gated backyard, but it pisses my wife off when she discovers I left it open overnight. My question is this…what would the programming look like to have the door check and see if it’s up and close itself at 10:00 pm every night?

Where can I learn the syntax/commands available to use in rules files? I’m loving the OpenHAB so far, and if I can get the rules file down, I think it can be a very powerful bit of software. Thanks for any help!


#2

Using a time-based trigger, you can send a command to close no matter the state. Be sure to have set the time correctly. I don’t know how the MyQ binding works, so I can’t help you on that.

rule closeGarageDoor
when
    time is cron "0 0 22 1/1 * ? *"
then
    //sendcommand(whatever item, closed) idk what 
end

#3

https://www.mksmarthouse.com/copy-of-blinds-control-software-windo

I’ll just use this as a guide and finger out what commands to send. :+1:t2:


#4

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