ESPHome BT Proxy as room presence - Help needed

I would really like to use ESP Home BT Proxy to determine my room presence and I am pretty sure it can be done easily but I am not that good at coding yet, looking for your support! :slight_smile:

This is my plan:
When my iBeacon is connected to a BT proxy, the iBeacon’s attribute ā€œSourceā€ show me which BT Proxy I am connected to. As I know the area of the proxy, then I know which room I am in.
Ideally, I’d like to create a sensor that if my iBeacon distance is >0 (or not null) thus I am connected, will show the area of the BT Proxy I am connected to.

Those are some rudimental checks I made:

{{ state_attr('device_tracker.ibeacon_simone', 'source') }} {## This is the ESP Proxy I am connected to ##}
{{ integration_entities(state_attr('device_tracker.ibeacon_simone', 'source')) }} {## This is the list of entities of the BT Proxy I am connected to ##}

{{ area_name('esp32-bluetooth-proxy-sala ') }} {## Trying to get the area of the device do not work ##}
{{ area_name('button.safe_mode_boot_3') }} {## The area of the entity of that device works ##}

This is the ourput:

esp32-bluetooth-proxy-sala
['button.safe_mode_boot_3']

Sala

As you can see, if I try to get the area of the BT Proxy device, it doesn’t work but I found a workaround, as every BT Proxy has an entity ā€˜button safe mode’, if I try to get the area of that entity it works!
So I managed to return the list of entities of the connected BT Proxy but I cannot use a list in the area_name

So close but so far.

I am pretty sure that you smart guys here can help me making ESPHome BT proxy also a room presence tool!

1 Like

Just a bump that was seeing exactly the same thing.

Now source is responding with the MAC of the BT proxy that last saw the beacon.

Any updates on how to resolve that to a particular room?

I ended up just renaming the device in the integration page to the mac address.
That way when I do the {{ area_name('esp32-bluetooth-proxy-sala ') }} part I just enter the mac address as the name like {{ area_name('aa:bb:cc:dd:ee:ff') }} and it works fine.
I realize this is not ideal and a bit of a pain to manage long-term but I’m sure something better will come up sooner than later.

For now I just made a template sensor that I can use for automations and not need to worry about updating then as I switch implementations (got the idea from another post).

- sensor:
    - name: Test Room Presence
      unique_id: test_room_presence
      state: "{{ area_name(device_id(state_attr('sensor.test_ibeacon_estimated_distance', 'source'))) }}"
1 Like