iBeacon randomly changes home/not_home


I got a Blue Charm Beacon. So far it works well with ESPpresence. But I’m struggling with the standard iBeacon integration.

While the beacon stays “home” nicely in ESPresence, I see this on the iBeacon integration:

I have no idea why it goes home/not_home randomly. The device is working properly, since using MQTT explorer I see it sends messages every 5 seconds. That’s why ESPresence works well.

I’m thinking my Raspberry Pi 3 onboard Bluetooth is the culprit…

Any ideas? Thanks

Hi Marce,

Did you set the beacon to broadcast every 5000ms? (I am guessing this because you mention that MQTT explorer sees it every 5 seconds).

That might be too long of an interval for the iBeacon Tracker integration to reliably capture. For example, if the tracker (i.e. the HA) is scanning for 1000ms, then resting for 500ms (this is called a scan interval of 1500ms and scan window of 1000ms), you can imagine how a broadcast every 5000ms might fall into one of the resting periods. In that case, it would report as “away”. Then maybe the next round, the iBeacon tracker would have better luck and then report the beacon as “home”.

Just speculation from me though. Hopefully someone more familiar with the integration can offer some other suggestions. In the meantime, try setting the beacon to broadcast every 500ms (wasteful for the battery, but just do it for a while as a test to see if it fixes the problem with the tracker integration).

1 Like

Thanks for the comment. “ADv interval” is still at 1022.5 ms (default value, I guess, since I didn’t change it).

I’m not sure why ESPresence picks up the message every 5 seconds. Although it’s not exactly 5 secs:

As you mentioned, I just set the beacon to broadcast every 500 ms. Let’s see!

Ok, my guess was wrong. I think the esp must be set to “scan period” of 4 seconds. So it only reports once every 4 seconds, and it probably throws out any duplicate broadcasts seen during those 4 seconds.

Anyways, that doesn’t seem to be linked to your iBeacon Tracker issue.

Re the integration, here’s a link to a comment I did a while back showing my setup using the integration. Maybe take a quick look to double check against your current setup.

I’m not using the integration anymore but at the time it worked fine (except for some long delays to show change of state in one direction; that might be fixed already.)

Just curious: why are you trying the integration if the ESPresence approach is already working well for you?

Also depending on the BlueCharm model and using the native protocol instead of iBeacon, with new models being added soon, Theengs Gateway (HA Add-on) does also recognise the beacons as device_trackers, for a reliable Home/Away presence detection.

Alternatively this also works nicely with Theengs Gateway when setting any iBeacon UUID to


1 Like

I’m “testing” the iBeacon integration because the ESP board needs shorter distance to detect the beacon. I’m using the beacon to trigger a flow that opens my building door when I press the ringbell button (Ring Intercom integration).

I know I could by some sort of extender device. But I’m trying to get by with what I have, for now…

About your other post, I had already read it when searching for info :slight_smile:

By the way, the iBeacon integration detects well my BC021, but it won’t detect the BC04P, which is weird. ESP is working well with that one.


That’s a nice approach! Thanks a lot. Let me give it a try and report back :slight_smile:

You’re probably already aware of this, but you can buy ESPs that use external antennas. Usually the model number ends in a “U”. You still need to buy the antenna from a separate supplier but they’re quite cheap. Having an external antenna definitely increases the range of the ESP.

1 Like

For extending the Theengs Gateway reception OpenMQTTGateway on an ESP32 can be used with either the esp32dev-ble-mqtt-undecoded binary for pure antenna proxy extension, or the esp32dev-ble binary, which actually does the decoding and publishing to the MQTT broker independently, along with the auto-discovery of the iBeacons with the above mentioned UUID or BlueCharms with native protocol as device_trackers, so that Theengs Gateway is not actually required.

The broadcasts from those two beacons are 100% identical, so the HA or integration should not treat them differently.

One possibility to check: Make sure the KC04P is configured to broadcast “Legacy” iBeacon (meaning traditional iBeacon), not Phy-Coded (meaning fancy new iBeacon standard that most scanners can not yet handle). You can see this setting under the iBeacon slot in the beacon configuration process. “Legacy” is the default but sometimes people are fiddling around with the settings and change something because it looks/sounds cool. :laughing:

Also be sure the motion trigger is not enabled. Default is disabled, but sometimes people are fiddling around… :sweat_smile:

More likely I think the integration has somehow excluded the MAC of the BC04P beacon. There are lots and lots of posts about how the integration filters or doesn’t filter out BLE items. Unfortunately I am not very clear about the cause or how to fix it. But it might be worth digging into this once you confirm the beacon is still at default settings.

Thanks. I’ll look into that too!

Checked! Default still enabled (Legacy mode and no motion trigger). Anyway I just reminded that I posted this some weeks ago:

I forgot I kind of found a problem with the onboard Bluetooth adapter. That’s another reason why I moved to ESPresence.

But now it’s even weirder, because it just forgets one beacon! I double checked my config and known devices. Both beacons are set in the same way:

  hide_if_away: false
  name: Beacon Dogs
  track: true
  hide_if_away: false
  name: Beacon Keys
  track: true