iBeacon and Android companion app for proximity tracking

Hello everyone,
I have a use case that I wasn’t able to address.
I would like to be able to track via my phone a beacon tag near my appartment door to open it automatically similarly to a nfc tag would do if you scan it with your phone.
With the new discovery of iBeacon tags within home assistant’s new update does anyone know if its possible to do that?

Thanks !

1 Like

You don’t even need a beacon. The companion app has an integrated beacon sender, and the new home assistant beacon tracker can recognize it.

So with a simple condition of the numeric state you can fire your automation to open the door.
But your home assistant must be near the door to work, if not you could use an esp32 as a bluetooth proxy (i’m not 100% sure) or use espresence:

Last one i’m using about a year to check if i am near before the door opens automatically. Works really good.

The other way round is a beacon scanner, this one is relative new in the companion app. It will give you a sensor with the estimated distance to the beacon.

1 Like

Hello, Thanks for the quick reply. :slight_smile:
My problem is that I live in an apartment building with multiple appartments.
I don’t have access to a an electrical source or connectivity near the front door which I would like to open. This is why I was thinking of using a beacon tag (running on batteries) and trigger an automation once my phone come’s near by. I could also use multiple beacon tags to triangulate more precisely my position with the street.
Those tags would rather act as antenna instead of trackers.
My phone is what I want to track.
I can’t find the ibeacon ref I bought but its similar to this one:

Thanks for your help !

I am very interested in the second solution with the beacon scanner !


I will autoreply to my question but I actually found the sensor in the app.
I’ll try it when i come home !

This is working for me:

sensor:
  - name: "Feasy Beacon Detected"
    unique_id: feasy_beacon_detected
    state: >-
     {% if state_attr('sensor.vog_l04_beacon_monitor', 'fda50693-a4e2-4fb1-afcf-c6eb07647825 10065.26049') != None %} Yes {% else %} No {% endif %}
    icon: >
     {% if state_attr('sensor.vog_l04_beacon_monitor','fda50693-a4e2-4fb1-afcf-c6eb07647825 10065.26049') != None %} mdi:bluetooth-connect {% else %} mdi:bluetooth-off {% endif %}

The trick is identifying the particular iBeacon’s UUID, major & minor numbers that make up the attribute name: [UUID] [major].[minor]

2 Likes

there is one app that can show you the broadcast uuid for sure; it’s called Beacon Scope by David Young in the Google play store. No iPhone version though.

Another good way to get the broadcast uuid is to use the beacon manufacturer’s configuration app. Use it to connect to the beacon then find the broadcast uuid major minor, then just copy and paste.

That’s what I did in my case.

This is interesting.
I have never thought of using a battery powered beacon.

I use a ESP32 to listen and transmit from the phone. This method is the other way around.
Seems much safer and better.

I’m going to get one and give it a try.

Using a phone to do beacon scanning or to act as a virtual beacon is always going to disappoint eventually. Best option is to use HA or ESP to scan for a battery powered (or usb powered) beacon. Leave the phone out of the loop. Phones don’t like apps that run constantly.

1 Like

My idea is to use Notification Commands | Home Assistant Companion Docs to turn on the scanning as I enter home zone and turn it off when I connect to wifi.

1 Like

Oh, that sounds like it might work better. Since it would turn on the scanning at the right moment, the app might get better priority from the smartphone OS. If so, you should be able to get good/fast/reliable scan results (e.g. the phone would see the beacon that was placed inside the front door).

I’m not familiar with the Companion app yet. Gotta spend some time playing around with it soon.

I’m getting the distance in meters after the Beacon ID instead of the major and minor. How would you go about matching just part of the attribute in a template instead of the part that’s constantly changing?

b9c6bafa-f04c-0e99-b04c-0c6900000469_0_0: 1.18
fda50693-a4e2-4fb1-afcf-c6eb07647825_1_61922: 0.22
icon: mdi:bluetooth
friendly_name: XQ-AT52 Beacon Monitor

You need to look at just the attribute, not the attribute’s value. Here’s my sensor:

  - name: "Feasy Beacon Detected"
    unique_id: feasy_beacon_detected
    state: >-
     {% if state_attr('sensor.vog_l04_beacon_monitor', 'fda50693-a4e2-4fb1-afcf-c6eb07647825 10065.26049') != None %} Yes {% else %} No {% endif %}
    icon: >
     {% if state_attr('sensor.vog_l04_beacon_monitor','fda50693-a4e2-4fb1-afcf-c6eb07647825 10065.26049') != None %} mdi:bluetooth-connect {% else %} mdi:bluetooth-off {% endif %}

Replace my UUID in the above with your UUID and pop it into Dev Tools, Template…

Also, format your code with three backquotes on a blank line and end with three backquotes on another line when posting…

These are my attributes. Just use the part up to the “:”…:

icon: mdi:bluetooth
friendly_name: P30-Pro Beacon Monitor
fda50693-a4e2-4fb1-afcf-c6eb07647825 10065.26049: 5184560600
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 4013.0: 162222156000000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 4107.0: 56654423000000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 4028.0: 108873797000000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 1553.0: 527287296000000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 4120.0: 2961734630000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 3996.0: 145458446000000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 4014.0: 205891136000000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 4108.0: 35411859000000
1ca92e23-f087-4df7-b9a2-fd4b716a4bf6 4607.0: 6069413200000

Awesome, thanks so much @dbrunt Do you know how I would be able to use the value too if say I only wanted to trigger if it was within X distance of the beacon?

That would require more elaborate templating based on the value of the attribute. I have not tried that since I am not concerned about the distance. In my case if it detects it, close enough! BT has a very limited range IMO…

1 Like

Has anyone had luck with Espresence and Android - Huawei?

My results, using the ibeacon from the ha app, and a m5atom next to where the phone stays all the time:
blephone

:expressionless:

Ive had ESPresense working just fine with 2 iPhones and 2 Apple Watches across 3x ESP32 devices. Took a little while to figure out the IRK values for the Apple stuff as it constantly changes MAC, but there is documentation on site to do it.

I just installed the standard ESPHome flash image on one of my ESP32 devices and I can’t get it to recognise any bluetooth devices yet, but it has appeared in HA, right now I might be sticking with ESPresense unless I suss this out!

1 Like