Automating Garage Door Monitoring

There have been a number of times in the past where the garage door has been left open all night or when no one was at home. This could be due to issues such as someone forgetting to close the garage door, or the door having problems closing without anyone noticing. I wanted to get a text message on my phone when the garage door had a problem closing, or had been open for more than 10 minutes. While there are some very well-written scripts for openHAB that do this in a more robust and flexible manner than my implementation, they are much more complex. I chose a more simple solution that does what I want. To implement this in openHAB I used a combination of groups, metadata, rules, and scripts.

The garage door has two “channels” defined in openHAB: the door and the alarm. The door channel reports the state of the door as a number where 0 means closed and 255 means fully open. The alarm channel reports either NULL meaning no alarm, or some text describing the alarm. After a period of time the data in the alarm channel changes back to NULL.

To send a text message when there is an alarm I created a rule that monitors the alarm channel for any changes. If it detects a change and the state of the alarm is not NULL, then it runs a simple script that sends an email to a place that then forwards the message to my phone as a text message. The reason for ignoring when the alarm data changes to NULL is so only one text message is sent when an alarm is raised. That is because when an alarm is triggered and provides details about the alarm, it then returns back to NULL state after a period of time. Both of those are changes to the alarm value, but I only want to receive a warning about the first change on my phone and not another one when the alarm clears.

I had a few options on how to implement the sending a text message if the garage had been open for more than 10 minutes. The solution I chose is fairly simple. On a previous version of the openHAB software, the garage monitoring rules were some of the most complex I had. While they handled a number of different scenarios and could easily be extended using groups to monitor other doors and windows, they were also more involved and mostly created by copying the examples other people provided. For this implementation I wanted to not rely on things I could not easily maintain.

The first thing I did is create a “Garage Door Timer” group. This group is a switch type meaning it can be “ON” or “OFF”. I then added metadata to the group so that 10 minutes after it was turned on it automatically turned itself off. The next group I added was the same except I named it “Garage Door Timer Long” and set the automatic switching off to occur after an hour. The idea being that one alert will be sent after 10 minutes, and then subsequent alerts in one hour increments. That way if I leave the garage door open on purpose such as when clearing snow or doing yardwork, I will not get alerts every 10 minutes that the garage door is open. But when I go back into the house forgetting to close the garage door I want to still receive alerts, but on a longer basis i.e. every hour.

I then created two rules: one that triggers when the garage door goes from closed to open, and one that triggers when the either of the garage door timers goes from on to off.

  1. The first rule detects when the garage door is opened after being closed. All it does is turn the garage door timer switch to on.
  2. The second rule detects when the garage door timer switch goes from on to off. It also checks if the garage door is open or not, (and “open” in this case covers both fully and partially open). If the garage door is still open then the rule sends me a text message saying that the garage door has been open for an extended period of time. It also turns on the “long” garage door timer.

This implementation is simple but covers my normal use of the garage door. I do not usually keep the garage door open for long periods of time, so a 10 minute alert of it being open should not be a nuisance. And if I leave the house forgetting to close the garage, I can use my phone to close it after getting alerted without it being open too long. However, when I may want to leave the garage door open for longer periods of time, I will only be sent a text message every hour after that.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top