BLE Beacon with iOS Automation to open garage door

Hi, I have a Meross MSG200 garage door opener capable of controlling 3 garage doors. My garage has 3 doors and all are used between 2 cars and a motorbike. The cars/bike are always parked in the same space so each door can be assigned to each vehicle in HA. The Meross is connected to apple Homekit through a Homepod Mini and is exposed to Home Assistant through the HomeKit Device Integration. The individual doors can be controlled with both Home Assistant and also Apple Home apps. The problem I have is when in the car and my phone is connected to carplay, the Siri suggestion to open or close a garage door pops up on the carplay home screen as it should within a certain radius of home, but there is no way to choose which of the 3 doors needs to be controlled. Siri only presents an option for one door which may or may not be the correct door.

The alternative is to use the Home Assistant carplay app, where I have the option to control whichever door I want by tapping on the desired door button shown on the screen. All 3 door buttons are displayed at once in the HA carplay app. That works well, however there is no safeguard to prevent a door accidentally being opened if I am far from home.

I have been experimenting with using and ESP32 board setup as an iBeacon so the beacon creates an “enable” signal for the open/close command in HA so that carplay will only work if my phone is within range of the iBeacon. This is where I am stuck. I don’t know how to have my phone automatically detect when the beacon comes within range of the beacon. Creating an iOS automation in the shortcuts app to do “something” when connected/disconnected from bluetooth doesn’t work because the beacon doesn’t show up as one of the bluetooth devices. I can manually scan for the beacon using one of several BLE beacon apps and the beacon is detected but I don’t know how to automatically detect a beacon when it comes into range. I assume the bluetooth connected or disconnected trigger in iOS automations doesn’t work with BLE devices.

The other option that comes to mind is to have a beacon in each car and have a device in the garage to monitor when a beacon comes within range and depending which beacon is detected, the correct door can be enabled to open or close.

I could use some help to point me in the right direction because I have confused myself trying to figure this out. I’m sure there is a simple way to do it. Thanks in advance for your help.

I think you might be overcomplicating things a bit :wink:

Why not just use the iPhone itself to open the correct garage door as soon as it gets into range of your home/garage? Or at least use the iPhone presence as the trigger to open which garage door.

You can use out Theengs Gateway Add-on’s iPhone BLE device tracker implementation for that, or any other smile solution.

Or get a BM2 or other similar inexpensive bluetooth enabled battery monitor for each vehicle, or small Bluetooth beacons, and have them be recognised individually for automatic opening of the appropriate garage doors - no CarPlay button pushing required :wink:

Hope this helps.

I’m not sure I understand what you mean by “use the iPhone itself to open the correct garage door as soon as it gets into range”. What method do I use to determine if the phone is in range or not? Are you saying I need to use Theengs Gateway or something similar to detect when my phone enters within range of the Bluetooth signal from the HA server?

The other option you mentioned sounds like what I was trying to describe in my first post about having a beacon in each vehicle. The BM2 battery monitor wouldn’t work because one of my cars is electric and the low voltage battery is buried in a not very easy place to reach. The car also doesn’t like having any kind of accessories plugged in when it is shutdown and locked. The bike also doesn’t have very much space to install accessories like the battery monitor but a BLE beacon would work. So if I were to use a different beacon for each vehicle, then the beacons can be identified and matched to the right car or bike to open the correct door. What kind of range do these beacons have knowing the beacon is I’ll be inside the car and the monitor is inside the house behind metal garage doors? I assume some type of monitoring device will need to be used that is positioned close to the garage which then feeds the information back to HA?

Sorry for the newbie questions.

Yes, use the iPhone to detect when it is coming close to your home, with the Theengs Gateway Add-on or any other of several other methods available for this.

So that when the iPhone changes from Away to Home the garage door automatically opens.

But dedicated Bluetooth trackers will do the same and if they are always in the car they will also work in case you do forget your iPhone on some days :wink: An advantage with the iPhone though is that is has a randomly changing Bluetooth MAC address for privacy, which you can only use for tracking knowing its Identity Resolving Key - that means it’s not possible for others to know of the presence of your iPhone, while Bluetooth trackers usually have static Bluetooth MAC addresses, so having them in the cars would theoretically also mean that others could detect the presence of the cars - a possbile theoretical privacy concerns.

Ideally you would also get Bluetooth beacons for this which also broadcast their battery status, so that you can swap the battery when it gets low, instead of only realising a dead battery when the garage door doesn’t open :wink:

Yes, each beacon can be identified individually, and their reception reach can be extended with ESP32 proxies on the same WiFi network positioned close to the garage doors for ideal reception.

Thank you, I appreciate your help. I think I will try the beacon in each car method. I have seen some Bluetooth beacons on Amazon that are tiny Ian devices which plug into a usb port. That will eliminate any battery going flat situations.

I am still sorting out some issues with the iPhone tracker. It has never been recognised as anything other than “Away”. The update interval also seems to be quite long, ranging from minutes to hours sometimes. I’m sure it’s just a setting either on the phone or in HA that I have overlooked. I don’t even know how HA decided to start tracking my phone. It’s not something I recall ever setting up. Anyway, I have some options to try with a beacon in each car and an ESP32 near the garage doors to monitor the beacons coming within range. I have several spare ESP32 modules to experiment with. Thank you again for your help.

1 Like

I have one of those as well. Just be aware that they likely get their power cut as soon as you stop the car engine, as most car USB ports then also cut the power. So they will wrongly register as away again as soon as your turn off the engine.

Which might have the nice effect of the garage door also automatically opening as soon as you start the engine again while still in the garage - still also walls making them show up as AWAY when the cars are off in the garage, indistinguishable from actual being AWAY.

It’s ok if the beacon loses power and registers as AWAY when the car is off. I don’t want the doors to automatically open or close at any time, the purpose of the beacon is to “enable” the garage door buttons in HA when it is within range of the beacon monitoring device in the garage. If the beacon is not in range then I want HA to ignore any door button taps in carplay or the phone app and perhaps (if it is possible) display a notification to say something like “Out of Range”. The logic would be something like…

IF (“beacon in range” AND “phone connected to carplay”) OR (phone connected to home WiFi) THEN enable garage door controls in HA

The electric car partially powers up while it is charging and I’m not sure if the USB ports get energised in this partial power state, hence the AND logic to also check if the phone is connected to carplay. The second part to check if the phone is connected to home WiFi is to allow control of the doors when at home and not in any car.

A secondary goal mainly as a learning exercise, which would also be nice to have feature, is to find a way to trick Siri to suggest the correct door on the Carplay home screen. The beacon can be used to identify the car which is always associated with the same door. I will try to use the information from this post on Reddit as a guide…
“I finally fixed Apple’s CarPlay for multiple garage doors”

Just a thought, and this is probably a question about iPhones and not HA. If there is a way for an iPhone to automatically detect a beacon when it comes within range, then a single beacon could be placed in the garage constantly transmitting its signal. The phone already knows which car it’s in when it connects to carplay so if it can also automatically detect a known beacon when it comes within range, then the same logic can be applied to enable the door buttons using only a single beacon instead of needing one in each car plus a monitoring device in the garage. I haven’t yet found a way for the phone to automatically detect a beacon without manually initiating a scan using one of the many available BLE scanning apps.