*The article below contains affiliate links. If you purchase an item after clicking on that link, I will receive a commission. Thank you!
When it comes to automating your garage door, there are many ways to do it. You can have Home Assistant track your location and open your garage when you get home, or you can have an alert sent to your phone asking if you want the door open. But what if you are on a walk and not driving your car? What if you have two or more garages and the car you drive is in a different garage? You wouldn’t want to open the wrong one or all of them if you don’t have to. I decided to build a ground up automation in Node-Red to tackle all of these issues.
Prerequisites
In order to do this entire automation, you will need to have a few different devices and protocols. First, you will need to have MyQ or any other garage door opener in your Home Assistant server. You will also need to have presence detection on your phone, so the companion app is a must. Finally you will need to have NFC tags to determine the vehicle you are currently driving.
If you are looking for a MyQ garage door opener, I recommend this one.
For a z-wave front door lock like I use at my home, click here.
Helper Setup
You will need to set up some helpers to get things started. You will need a helper for each person and each vehicle that you drive.
Head over to Settings –> Devices and choose the top tab that says “Helpers.” You will want to add a new dropdown helper and we will create the person driving helper.
In order to know which garage to open, we need to know which vehicle is being driven. The first option will be “Nothing” in case we are on a walk or not driving. This will make sure that the garages don’t open when you get back from a walk. Next we will list every vehicle that is stored in the garage. Once that is done, this helper is all set.
Next we will make the helpers for each vehicle. This will allow us to determine the garage to open based on which vehicle is being driven.
In this example, the truck can be stored in either the 2-car garage or the 1-car garage. After the helper is created, you can click over to the “info” tab and select the garage to open when you drive the truck.
Proceed to do this with every vehicle you plan to automate.
I added a card to my dashboard so that I can quickly change these if need be.
Basic Automations Setup
Next we will setup the automations in Home Assistant to actually open the the doors. The idea for this is that we will be sending iOS actions to Home Assistant to open each door based on the automation from Node-Red. We will get to that later, but just wanted to let you know how the triggers will work.
For this automation, we will be using an iOS notification called OPEN_1. This will trigger the action to open the one-car garage. It is a very basic automation which is all it needs to be. We will repeat this for the two-car garage as well. I also added one for unlocking the front door unless I am on a walk.
Now that we have all of the opening automations, we can move on to the tags.
Tag Setup
Now we will setup the tags for each of the vehicles. To set up the tag, you just need to use the companion app and create a tag with the name of each vehicle. Next you will just need to find a place to put the tags in each of the vehicles. In the Tahoe, there is a handy location at the top of the center console where I was able to put the tag. It makes it simple to get in the car and scan the tag to get Home Assistant to know I’m driving the Tahoe.
Node-Red Tag Setup
In order to change the vehicle we are driving, we will use Node-Red. This flow will look for any tags that are scanned, and route who scanned it with which vehicle was scanned.
“Events:all” is an event node that listens for all events. We will change the event type to “tag_scanned” so that is only filters tag scanned events.
“Who scanned it” is a switch node that will route the flow based on the person who scanned the tag. Unfortunately this switch node requires the “device_id” which is not shown anywhere in Home Assistant, so you will need to use a debug node and scan a tag to determind what the device_id is for every person that can scan the tag.
“Which Vehicle” is a switch node to determine which vehicle is being driven. This node uses the “tag_id” so you will need to go into your tags to get the full id, since it cannot use just the name of the tag.
Once both of those are set then the last node “Set Sean Vehicle to Tahoe” is a call service node. We will use the domain “input_select” and the service “select_option” to change the entity “Sean Driving” to Tahoe. We do this by adding in the “data” field {“option”: “Tahoe”}.
Do this same setup for every vehicle that has tags and every person that will scan. It can be a lot of setup but it will make it all worth it in the end.
Node-Red Garage Setup
Now comes the fun part. The Node-Red automations. To give a quick overview of what we are trying to do, when I get back home, I want Home Assistant to check which vehicle I am driving, find where that vehicle is parked, and open up the correct door. In the case that I am on a walk, I want to receive a notification to my phone that gives me options to open one of the garage doors or to unlock my front door. After that it needs to reset the vehicle I am driving to nothing so that I can do it all over the next time I leave the house.
This is the entire flow. It starts when I get home, finds out what I am driving, then routes to the vehicle to see which garage that should be in, then sends the corresponding open command. After that it will send me a notification telling me the garage is opening and then reset my vehicle to nothing. This can be expanded with more vehicles if need be. Ignore the timestamp node at the bottom, that is how I test the notification on my phone.
“Sean Comes Home” is a state node. It is set to trigger whenever I come back home.
“What is Sean Driving” is a current state node. This will check the helper what I am driving and pass that information on to the next node.
“Route Sean’s Vehicle” is a switch node. It takes the payload which has the vehicle I am driving, and routes it to that vehicles specific flow. In this case, we will say I am driving the Tahoe. All flows after this are similar.
“Get Tahoe Garage” is a current state node. This checks the garage that the Tahoe parks in.
“Open Garage (1 or 2)” is a call service node. This uses the domain “Cover” and the service “open_cover” to open the Two Car garage entity.
Once this happens you can have it send you a notification like I do or go straight to the “Reset Vehicle to Nothing” node.
“Reset Vehicle to Nothing” is a call service node. It uses the domain “input_select” and the service “select_option”. In the data field you will write {“option”: “Nothing”} which is one of the options named in the dropdown helper sections above.
If I am not in a vehicle, that is all handled with the “Send Notification” node at the bottom of the “Route Sean’s Vehicle” node.
“Send Notification” is a call service node. This will use the domain “notify” and the service “mobile_app_XXXX” where the XXXX is the phone you want to receive the notification. The data sent is where the brains of this all comes together.
{
"message": "Which door would you like to open?",
"title": "Welcome Home!",
"data": {
"actions": [
{
"action": "OPEN_1",
"title": "1-Car Garage"
},
{
"action": "OPEN_2",
"title": "2-Car Garage"
},
{
"action": "OPEN_FRONT",
"title": "Front Door"
}
]
}
}
It starts with a message “which door would you like to open?” and the title of “Welcome Home!”. Next we will need to send some actions that get added to the data array. Each action becomes a button when you long-press the notification on your phone.
Each of these buttons, when pressed, will send an action to Home Assistant. These actions will correspond with the Basic Automation Setup actions that we setup above. So pressing “1-Car Garage” will send the “OPEN_1” command using ios.notification_action_fired and will then open the 1-Car Garage. Since we came home in the vehicle of “Nothing” we do not need to reset it back to “Nothing.”
Conclusion
And there you have it. Now you just hop in the car, scan the tag, and when you return home the correct garage is opened automatically. If you left your home without a vehicle, the ios notification will give you the option to open any of the doors you have.
2 responses to “Massively Overbuilt Garage Door Automation with MyQ and Home Asssitant”
Awesome post! This helped me setup my own simple actionable notification system. Thanks so much!
You’re welcome Jeremy! Thanks for reading it.