When I am getting ready to leave the house I like to be able to issue a single command such as "turn on leaving mode" and have the home automation perform the following actions:
- Turn off all the lights in the house
- Turn on the lights in the area where you exit the house to the garage
- Open the garage door
Then, after a certain period of time passes, do the following:
- Turn off all the lights that remain on, (which should just be the ones in the area where you exit from the house into the garage)
- Close the garage door if it is still open if I forgot to close it, (which has happened more than once)
When I am returning home through the garage, (meaning the garage door started opening when formerly closed), I want to automatically turn on the lights inside the house in the area where you enter it from the garage. As I add more equipment, I can also automate more things such as: lock all the doors, arm security, and alert me if any windows are open before I leave.
To implement this in openHAB I used a combination of groups, rules, and metadata. The first step was to create a group giving it a description of "Leaving Mode". I made that a switch that can either be "ON" or "OFF". After adding the metadata used by the Amazon Echo devices, I could then use the voice command "turn on leaving mode" to switch this group into the "ON" state. I then added additional metadata to automatically switch to the "OFF" state five minutes after being turned on. Next, I created two rules that monitored the state of this group.
The first rule I created was to cover the entire "returning home" scenario. The rule monitors the garage door for when it transitions from a "closed" state to an "opening" or "open" state. When this is detected, it then triggers the rule to turn on the interior lights in the area where you enter the house from the garage.
With the automation in place to handle returning home, the next rule created was to trigger certain events when leaving the house. Since one of those actions is to open the garage door, that event would be caught by the "returning home" rule. which in turn turns on the necessary lights automatically. When this rule is triggered, it will:
- Turn off all the lights inside the house, (which all belong to a single group meaning you just have to switch the group off).
- Open the garage door, (which in turn will turn on or back on the necessary lighting).
This has a couple minor flaws, however. For example, when turning on leaving mode when the garage door is already open, the rule to turn on the desired lighting does not occur. Another minor annoyance is when the desired lighting is already on, there may be a slight flicker as the lights are turned off in the first step then immediately turned back on in the next step. I have an openHAB script from my prior implementation that handled these cases, but when moving to openHAB 3, I wanted to try and use the graphical interface and avoid scripting as much as possible.
Another thing that might happen is that the garage door may be unable to close due to an obstruction or other issue. In that case I have a separate rule described elsewhere that monitors the garage door and sends alerts to my phone if the garage door has an issue, or is open for an extended period of time.