iBeacon Location

I’m attempting to trigger an automation based on the presence of an iBeacon, specifically a BlueCharm BC011. This device is configured to transmit an iBeacon continuously, but also has the ability to transmit a second iBeacon with a different UUID when a button is pressed. I’ve tested this successfully with espHome, but due to range limitations and location of the ESP32 I’m using, it doesn’t consistently detect the button press.

After doing some reading today, I have the understanding that the Mobile App on my iPhone can detect an iBeacon for the purpose of establishing location. Since my iPhone will typically be near the BlueCharm - both in the car - when I press the button, I’m assuming it will be more reliable due to the proximity of the two.

I’ve added the following to configuration.yaml:

mobile_app:
  customize:
    zone.home:
      beacon:
        uuid: <ibeacon UUID> (This is the UUID associated with the button)
        major: <iBeacon major>
        minor: <iBeacon minor>

I’ve rebooted the iPhone and I’ve restarted the core application. However, device_tracker.<my_device> always shows “Home”, even though I have not pressed the button. Looking at the attributes for device_tracker.<my_device>, it shows “source_type: gps”. So it appears the entry in configuration.yaml is ignored. Also tried this with same result:

homeassistant:
  customize:
    zone.home:
      beacon:
        uuid: <ibeacon UUID> (This is the UUID associated with the button)
        major: <iBeacon major>
        minor: <iBeacon minor>

What am I doing wrong?

Have you considered switching to an ESP with an antenna? I have found the range to be much better when using these compared to the typical ESP32 with an PCB-based antenna.

I have used these with good results in the past: https://www.amazon.com/gp/product/B09D3TGJGD/

You also have to buy an antenna. Something like these or maybe a longer one: https://www.amazon.com/gp/product/B07D1Z3W7T/

Thanks for the reply and suggestions, Thomas. I think an ESP with antenna is likely my next step, but I’d still like to know whether the mobile app can detect an iBeacon and, if so, how to configure for this.

1 Like

I seem to have this working after a fashion, thanks in part to this post: iBeacons unusable when having a home zone - add subzones (solved with workaround). I added the following to configuration.yaml:

zone:
  - name: BlueCharm
    latitude: 1.2345
    longitude: 6.7890
    radius: 0.3
    icon: mdi:garage
    passive: true

homeassistant:
  customize:
    zone.bluecharm:
      track_ios: true
      beacon:
        uuid: <ibeacon uuid>
        major: <ibeacon major>
        minor: <ibeacon minor>

The latitude, longitude and radius for the zone are arbitrary, but far away from my location. Unlike the link above, I don’t use these values. My automation looks like this:

alias: Sandbox Notifier
description: ""
trigger:
  - platform: state
    entity_id:
      - device_tracker.rwr
    to: bluecharm
condition: []
action:
  - service: notify.mobile_app_<mobile_device>
    data:
      message: Change to BlueCharm
  - delay:
      hours: 0
      minutes: 0
      seconds: 15
      milliseconds: 0
  - service: notify.mobile_app_<mobile_device>
    data:
      message: request_location_update
mode: single

I set the BlueCharm to only advertise the beacon that is activated by the button press for 10 seconds, with an advertising interval of 2000ms. It’s necessary to have the automation requery the mobile app device after the beacon quits advertising, so I set the delay for 15 seconds.

In the Companion App, under Location in the Settings section, I turned on “Zone enter/exit” and “Background Fetch”, but I can’t say with certainty that these are required. The response time can lag a few seconds - I suspect due to the Companion App’s scan timing - but is OK for my use case.

There seems to be a brief period of several seconds after the button press during which the button press is ignored. I haven’t been able to specifically identify the length of this interval, however. It’s not an issue for my use case.

You might try a shorter interval on the beacon to get faster results. Since you are only broadcasting for ten seconds after the button press, you can afford to use more battery power than usual. Try setting it to 300ms to see if it improves the reaction time.

Like you said though, this might not help if the scanners have short scan windows and lots of non-scanning gaps. This can be adjusted in ESP devices but not on smartphone apps.