Changes to enable Room Presence tracking with the iBeacon integration

I have ble ibeacon configured on my android companion app, and a number of Shelly devices set up as bluetooth proxies around my house. I made a simple sensor to determine my Area based on the iBeacon Source:

{% set source = state_attr('device_tracker.matt_phone', 'source') %}
{% set devices = integration_entities('shelly') |  map('device_id') | unique | list %}
{% for d in devices %}
{% set area = area_name(d) %}
{% set key, value = device_attr(d, 'connections') | first %}
{% if (value | upper) == source %}
  {{area}}
{% endif %}
{% endfor %}

This appears to be quite effective. The primary issue is that the source attribute is updated infrequently (minutes?). Please offer an option to set the rssi/source update frequency. Ideally as low as 5-10 seconds.

Additionally, if it’s not too difficult, you could build a map from bluetooth mac addresses to devices to Areas and include an “Approximate Room” entity as part of the ibeacon integration.

This would murder your phone battery.

1 Like

In fact, sending an update to HA every 10 seconds while you are at home would be heavy on the phone battery.

What about setting the state of your location sensor based on the last Bluetooth proxy that saw you?

The one I’m looking to be configurable is UPDATE_INTERVAL in here. If I’m reading it correctly, this is independent of the phone update frequency. This is how often the integration updates your RSSI/Source based on the latest ping it received. Since this is server side it should be much less performance sensitive than the phone update rate, but no matter how often your phone is pinging, it can’t update any faster than this. I may still not get reasonably fresh location data from this change, but I don’t see any reason why it can’t be configurable or much smaller by default.

Because it is unnecessary. Location updates are pushed to home assistant when they occur, HA does not poll the location. There are methods to to cause this to occur more often. See: Location | Home Assistant Companion Docs

EDIT: It seems that iBeacon updates are iOS only. This would likely be a limitation of Android OS that HA has no control over or it would have been implemented.