Automation to open specific garage door on return?

Hey Everyone!

I’m trying to write an automation that automatically opens the correct garage door when a person returns home.

Here is what we have so far:

  • Geofence zone around the house
  • Two persons with trackers (phone app w/GPS)
  • Three smart garage doors
    • His car
    • Her car
    • Fourwheeler

Any person could technically take any vehicle, meaning there is typically no direct correlation match between a vehicle and a person. Both persons could leave at different times and return at different times. Both persons could leave together in the same vehicle and return together. Also, both persons could leave in the same vehicle and only one person returns.

The only limitation to this setup that I could think of is if both persons leave simultaneously in separate vehicles; you wouldn’t know who is definitely in which car, but we could fall back on “she took her car; he took his car” in that specific case. If that’s wrong when the person returns, manual override (bummer).

It would also be nice if the automation could remember what to do even after a system reboot while the person(s) are away.

What all variables and storage and YAML and logic would get this automation going? Is there an existing example that could help me?

Thanks for being awesome!!

If your cars have Bluetooth you can enable the sensor in the HA companion app to set the car based on this. I then just becomes a choose of which car is connected to which door opens.

You could have the car saved as an input.select instead which would not be effected if for some reason the connection dropped and allows for it to be manually changed easily.

Another way would be to use the door opening as the trigger and then wait the next person to leave and assign them to that car using an input.select so it is easy to manually change.

Oooooh, check the Bluetooth beacon of each vehicle… I wouldn’t have thought of that! (This is why I love you guys!)

I was originally thinking something along the lines of:

  1. Detect which garage door opened (#1, #2, or #3)
  2. Detect who exits the “Home” range (Just person #1, Person #2, or both)
  3. Associate the door and persons together
  4. When a person returns, open the associated door

Adding in Bluetooth identification could increase the reliability of the association by confirming the person didn’t just open multiple garage doors (for whatever reason) and then left with one particular vehicle. It also could be used to detect if the garage doors were opened but nobody actually took a vehicle.

I have some ESP32 modules lying around. What should be used for the Bluetooth detection part? ESPresense? Something else?

Thanks again for being awesome!

What I meant was to just use the HA app as it will give you a list of all the Bluetooth devices connected to the phone.
You should then be able to have this associate the car and the person and it won’t matter if both people leave at the same time or don’t come back together.

The logic you have should work for this and won’t need a Bluetooth proxy.

Hmmm, almost, I think. I know when my wife and I get in the car at the same time, it’s a 50/50 chance of whose phone will connect to the car first since both can connect.

Actually nevermind, that would actually work really well if both persons leave in both cars, but both return in one car (dropping off one car for extended maintenance). The connected Bluetooth device would tell Home Assistant which car is returning and open that door. Nifty!

Is there a special setting in the phone app that needs to turn on for this Bluetooth-connected device functionality or is it on by default?

Also, If I wanted to set up an ESP32 Bluetooth beacon detector for the garage, what would I use to set that up?

I’d like to detect which phone was in the garage and which vehicle has left (assuming the car Bluetooth has an identifiable beacon). The general assumption is her car is in #1, his car is in #2, and the four-wheeler is in #3, but confirming with Bluetooth would be cool.

I would also like to eventually set up home room presence detection later on, so this may be step #1 towards that goal.

You need to enable the Bluetooth connection sensor in the app settings.

I’ve haven’t set one of these up but you would need to use ESPHome on the ESP32.

Ahh, yes, I see it now! It’s the “connected_paired_devices” attribute.

Is this also available on iOS devices?

(I have Android and can’t check myself.)