ESPresense, Wear OS, and Tips/Tricks

For those of you wanting BLE presence detection on Wear OS, the newest Home Assistant Android App Beta has a beta Wear OS version that allows you to enable an iBeacon. Release beta-3074-d7ee3953 · home-assistant/android (github.com)

I’ve sideloaded this on my wife’s Samsung GW4 and am very pleased with the results. I couldn’t get her to carry her phone around the house with her, but she always wears her watch!

If you’ve used ADB then sideloading the current beta is pretty easy, here is an article for Samsung Watches, I’m guessing other flavors are very similar 3 Ways to Install, Sideload, and Uninstall Apps on Samsung Galaxy Watch - TechWiser

I’ve recently installed ESPHome and tested the BLE receivers and new iBeacon integration, but honestly I deleted it all and returned to ESPresense. The configuration options required to maked beacon tracking just aren’t in the new integration, but I’m sure it will mature over time.

I’ve found with ESPresense that 2 options are critical to get useful presence tracking results -

  1. Limiting the reporting range of the receivers
  2. Filtering at the receivers

I’ve got 6 of the M5 Atom stack ESP32 devices with BLE and they are tiny and relatively cheap. I plan to add a few more. Since there is a bit of range overlap, it’s best to limit the reporting distance for devices to as small a space as the room you deploy them in. ESPresense uses the mqtt_room functions so the receiver with the best signal will win, but limiting the range lowers the chance of bouncing between 2 receivers.

Another poorly documented feature of ESPresense that is super handy is the ability to change the IDs of devices. If you use iBeacons like me the IDs wind up being 50+ characters. The reason this is an issue is that the include/exclude filter options of ESPresense have limited text characters. I use the settings function to change the IDs to 4 characters, then you can use the new ID names in the filters. This way I can get 10 or so devices in a filter list.

You can use an MQTT tool like MQTT Explorer to change the ID and adjust the RSSI of devices with the topic

espresense/settings/{beacon_id}/config

and a JSON payload of

{“id”:“abcd”,“name”:“myname”}

If you’re using a new version of ESPresense on your receivers you can see an example of these under the espresense/settings topic as the receiver generates it’s own beacon and sets a short name for itself.

In the include/exclude fields of the receiver web configuration you can use the new IDs separated by spaces. In the include filter for example you can put

abcd efgh ijkl

and only those 3 beacons will be reported by that receiver.

Sometimes it’s helpful to specifically include beacons, sometimes it’s better to exclude. For example I have a receiver in my garage to track vehicle arrival/departures, but I don’t want it to report my trash bin, so I exclude that device. Makes it easy for the trash bin to report not_home when at the curb.

Using these strategies I’ve been able to get good results for controlling fans in my office and other rooms as I move from room to room.

3 Likes

great information.
I will test this.
I think this its include in the actual version 2023.1.1 because the beta you say is previous that the 2023.1.1

i will test in the next days.
Its very interesting for me the ble tracking with espresence in my galaxy watch 4

thanks again for this information!

EDIT:
@mterry63 witch is the name that apears in espresence for galaxy watch 4?
its unique?

Im monintoring the results in mqttexplorer, and see a lot of samsung:XXXXX devices.
And i think is the watch changing the ID:
Do you have a unique ID? what config you enable in the watch?

thanks a lot

The beacon shows up in Espresense as iBeacon:xxxx-xxx-100-1. The Watch and HA Companion app always create beacons that end in 100-1 by default.

If you don’t see this iBeacon from your watch, you must have the HA Companion Wear OS app installed that supports this feature (the most recent Play Store version does I believe), and you must have enabled the beacon under the Watch app settings (The HA Companion App docs are well written and should help).

OHHH, great great. i can see “ibeacon:xxxxxxxx-100-1”
thanks a lot! i will make test again

thanks!!!

hello again.
I have a galaxy watch 4 and works fine with the ble beacon of home assistant app in the watch.
The watch generate the ibeacon:xxxxxxx-100-1 and works

But i bought a galaxy watch 5 for my wife and i cant replicate this. The ibeacon never apears :frowning:

I have EXACTLY the same issue, wife and all. Would also appreciate some advice on this.

Is this an issue of ID length for inclusion/exclusion? As mterry63 mentioned in his initial post? I think I will go down the custom ID route to make these shorter and see if the Galaxy Watch 5 starts reporting.

Hello!,
I think this is not a issue with the ID length, because the problem is the ibeacon:xxxxx of the galaxy watch 5, not apears in a scan. The watch not generate the ibeacon!

If this was a problem with the lenght, you can see the ibeacon with mqttexplorer or with a ble scanner in a mobile phone. and i cant :frowning:

I think its a problem with galaxy watch 5, that use bluetooth 5.2 and not 5.0 (i dont know if this is the problem)

1 Like

You should open an issue with the Companion App Github. The authors are very responsive.

Issues · home-assistant/android (github.com)

IBeacon not works in galaxy watch 5 · Issue #3534 · home-assistant/android (github.com)

thanks for your advice!

1 Like

for the rest of the people. if you have a galaxy watch 5 and you want to use the ibeacon with espresense you must setup the ibeacon launching notifications to the watch to configure the advertise mode as balanced and the transmitting power as high

Do we sideload the standard android app?

Should this be available in Playstore now?

It’s no longer necessary to sideload either the watch or companion app, iBeacon support is included in both. This is supported in the current Play Store companion app. You just need to enable it on the watch or phone as desired. The beacon UUID will remain the same unless you factory reset.

Thank you your fast response.

Is it the ble transmitter sensor I need to enable?

Yes. That’s all on the watch. There are other specific settings on the phone sensor. You’ll need some type of beacon receiver app, or use ESPresense to identify the UUID being broadcast from the watch. The phone UUID is listed at the bottom of the BLE Transmitter settings.

I got it working with Esprecense. Is it possible to increase the strength of the watch ble?

Not that I’m aware of. The value is set from the standard power output expected by the receivers, so if you do manage to raise it, you’d need to recalibrate ESPresense or any other receiver providing distance values.

1 Like

hi I would have been stuck in this thing with watch5 because by inserting ibeacon found easily in the esp32 logs in the configuration yaml of ha sees the sensor but does not track it and tells me not_in home could you tell me the right configuration? I am going crazy
Thank you

Post your configuration for the beacon.

sensor:

  • platform: mqtt_room

    name: “Watch 5 BLE”

    device_id: "iBeacon:xxxxxxxxxxxxxxxx

    state_topic: “espresense/rooms”

    timeout: 1

    away_timeout: 0

according to the documentation here away_timeout: 0 disables toggling the away state. I don’t believe 1 seconds and 0 seconds are realistic numbers in any case.

Have you confirmed with a tool like MQTT-Explorer that the state topic espresense/rooms is actually being updated with the device ID you referenced?