Garage Door Opening and Closing based on iBeacon in Car

Hi All,

This project is an addition to the already existing BLE scanner in my garage. My trash can reminder project already uses this same scanner to determine if the trash cans are inside the garage on trash night and, if so, reminds me to take them out to the street. Since the scanner is already there in the garage, I thought it would be fun to add on this garage door open/close automation.

Overall, I am really happy with the results. This automation is the first one that my wife is visibly impressed with every time we arrive back at our house. :smile: I had to do some tweaking on the smoothing filter settings, but just some small adjustments to the numbers to prevent the garage door from closing on its own after I drove my car back into the garage. Other than that, it’s been very smooth and effective.

Before you click the link below, the basic idea is (quoting from my write-up):

The basic concept

This one is obvious: it opens and closes the garage door automatically.

Firstly, we will place a BC-U1 usb-powered beacon in the car in one of the powered/unpowered slots. When the car is turned off, the usb beacon gets no power so doesn’t broadcast. When the car is turned on, the beacon begins to broadcast. (If your car doesn’t have this sort of USB outlet, you will probably need to make some adjustments to the settings and automations, but it shouldn’t be too difficult.)

Secondly, we will attach a BC-S1 door position beacon to the frame of the garage door, and attach the little magnetic sensor thingy to the garage door itself. The gateway will also scan for the beacon broadcast from this beacon in order to determine if the door is open or closed, since we have different thresholds/conditions for action based on whether the door is open or closed.

The BLE beacon-scanning gateway (BCG04) was already installed inside the garage for my other project. The gateway scans for this known “car beacon”, then sends this scan data to our Home Assistant (HA) installation running on the same wifi network. The HA can be anywhere in the house as long as it is connected to the same wifi.

The HA will have an MQTT server integration installed on it in order to act as an MQTT server (a.k.a. broker). So the MQTT server on the HA will receive the data “published” from the gateway, and make it available to any service “subscriber” on the HA that wants to use this data.

Next, we will create an MQTT sensor (sort of a virtual sensor since there is no hardware) on the HA that will subscribe to this specific beacon’s published MQTT data. This sensor will report the signal strength of the beacon.

But since the signal strength of all BLE beacons is sometimes a bit jumpy due to signal bouncing and wifi interference, we will create a second “filter sensor” that will smooth this MQTT sensor data.

Finally, we will create two HA automations. The “open the door” automation checks:

1. Is the car beacon seen by the scanner?
and
2. Is the door closed now?
(and some other conditions)

If so, then trigger the door to open.

That automation takes care of the initial opening of the door when you first get in the car and turn the ignition key (or press the start button for an electric car like mine).

It also opens the door when you return from a drive.

The other automation, the “close the door” automation, checks:

1. Is the car beacon seen by the scanner and the signal power weaker than -65 (i.e. the car is out of the garage now)?
and
2. Is the door open now?
(and some other conditions)

If so, then trigger the door to close.

Required hardware (at least this was required for my old-fashioned door):

Car Beacon: In this project I am using a BC-U1 USB-powered beacon.

Door Position Beacon: I used the BC-S1 Door Position Beacon. This beacon can be configured to broadcast one UUID when open and a different UUID when closed. The gateway can see this broadcast and thus know whether the door is currently open or not. If you have a more high-tech garage door opener, you might not need this.

*Beacon Scanning Gateway: I am using the BCG04 BLE scanning gateway. *

HA: My HA is running on an rPi and is (something something technical info here)…Honestly, I am not much of an HA expert.

Garage Door Opener: My garage door opener is quite old so completely not compatible with anything high tech. Even the door open/close button is one single button instead of two distinct buttons. So I attached a Shelly 1 Wifi Relay switch to it.

Shelly 1 Wifi Relay Switch 15A. I powered the relay switch with an old power plug I had laying around.

I am quite sure you HA aficionados will be able to improve on my automation. In addition, while you are walking through this setup, I can imagine that you will think of lots of other things a BLE gateway can do with beacons and automations. Remember that a single gateway can scan for many different beacons and report this data to the HA. Once there, the data can be used for multiple different automations based on multiple MQTT sensors (i.e. beacons or a virtual beacon on your smartphone).

Thanks for reading. Let me know what you think!

Thomas at Blue Charm

Here’s the link for the full project write-up:

This isn’t safe for you or your family.

There is a reason why modern garage openers use some sort of anti-replay protection in their communications.

Due to the design of your system, anyone can spoof the beacon that your car very obviously transmits wherever it goes, and therefore anyone with a cellphone and an app can then open your garage door.

I would like to discourage anyone seeking to get the same results from following the method you describe here.

Better to use the Home Assistant Companion app (e.g. with a lockscreen accessible action tile that requires fingerprint activation) to trigger a door opener in the home that is automated by ESPHome.

Alternatively, open the garage door only when the beacon indicates sufficient proximity and Home Assistant detects that your phone just connected to Wi-Fi (which should work if you have an access point in your garage) — this at least cannot be spoofed by someone who doesn’t have your Wi-Fi password. Note how this will work whether you start the car inside the garage, or arrive with your car running to park your car in the garage.

If the phone is not an option, consider building an ESPHome device that is securely paired to your Home Assistant, hooked to the switchable power rails of your car, and keeping the device in your car, such that when the ESPHome device connects to Home Assistant (which requires you in your car to be physically proximate to your Wi-Fi network), that itself is the signal to open the garage door. Or put a push button in the device, and have that be the door opener. If someone steals your car, however, you will have to change the Wi-Fi password and unpair the device.

Theoretically, sure. But I am not concerned about this for a couple of practical reasons.

In our area, 99.9% of the property crimes are committed by meth zombies. Their preferred method of entry is the much more low-tech “go around the back or side of the house and kick the door in” method. They’re not about to tech spoof anything.

Secondly, it would be much easier for some techy person to just spoof my old-fashioned garage door opener remote (It was installed in 2001). All they would need to do is hang around and record my remote code. Basically the same thing they would need to do to record my beacon uuid.

Thirdly, I have a locked door from the garage to my home. International jewel thieves will be sorely disappointed by the assortment of dirty car wash towels, trash cans, and half-broken Harbor Freight power tools I have in my garage.

But if you are still worried about it, I think your idea about using the wifi connection as a secondary “green light” is a good one. It might cause some time delays though, plus I am not sure how far my wifi reaches out into the street. Maybe I could add a wifi-repeater in the garage to make that a workable solution.

I would not bother with a beacon for the car and just use the condition that if the phone is connected to android auto/carplay and enters the outer zone for the garage door then open garage door and a delay to close it automatically set to how long it takes to park inside and set another inner zone for when driving out of the garage to trigger the door to close when your car is fully through the garage door.

Having the condition of the phone connected to the car to allow the automation to be enabled and ran adds that extra failsafe from it automatically opening and closing the doors when you are in the garage with you phone and not being in the car at the time so that you can still have manual control of the door(s) via say NFC tags made through the HA companion app placed in the car and in the garage where you would access them the most.

There are other automation’s you can do based on maps where if you have the destination set to home are it detects you heading in that direction and you are within x min away or x distance away you can tell it to do more tasks related to your garage and home needs before you arrive.

I would be a bit worried that some odd conditions would someday cause me to delay entering the garage (e.g. a chatty neighbor has something “interesting” to tell me). That’s why I chose to have no automatic closing after you enter the garage.

Another idea would be to raise up my garage door’s light-sensing beam safety thingy a few inches to prevent it from closing when the car is half way into the garage. As the light beam sensor is installed currently, it is too close to the garage floor, so it actually can NOT sense the car when the sensor is between the front and back wheels. In other words, the light beam currently travels underneath the car and can NOT sense the car when the car is midway into the garage.

As long as you have a consistent detection of the car when it needs to be detected, the delay in the reply previous was just one option as a action to trigger the next function.

Yes the light sensor would be a good option for a delay trigger if you can get it setup right and be used as a safety trigger at the same time so that if the light is broken then assume something is not clear of the door closing and only close once its clear after x seconds have passed or just call a notification to the phone with a confirmation action for keeping that safe manual control when its needed.

1 Like