Fetch and parse battery status from a non standard BLE device with ESPHome

You should also set the BT: Connect interval up to 60 minutes or so, as you do not own any sensor/device AFAIK which requires a connection, but might have some in your neighbourhood.

Just to see if this makes a change to your missing “state”:“offline” messages and AWAY status of the Feasy beacon.

Below, current relevant topic values while device is online:

homeassistant/device_tracker/001D439A010A-tracker/config

{"stat_t":"+/+/BTtoMQTT/001D439A010A","name":"FEASY-tracker","uniq_id":"001D439A010A-tracker","val_tpl":"{% if value_json.get('rssi') -%}home{%- else -%}not_home{%- endif %}","source_type":"bluetooth_le","device":{"ids":["001D439A010A"],"cns":[["mac","001D439A010A"]],"mf":"Feasycom","mdl":"FEASY","name":"108-010A-9A010A","via_device":"OMG_ESP32_BLE"}}

home/OMG_ATOM_L/BTtoMQTT/001D439A010A

{"id":"00:1D:43:9A:01:0A","mac_type":0,"adv_type":0,"name":"108-010A","rssi":-60,"servicedata":"27021992dc0d3016d03864","servicedatauuid":"0xfff0","brand":"Feasycom","model":"Beacon","model_id":"FEASY","type":"BCON","track":true,"beaconmodel":"BP108","batt":100,"plugged-in":false,"mac":"DC:0D:30:16:D0:38"}

Done! Will give you feedback after a while. But I’ve been powering on/off the beacon several teams and It works fine for the moment. I hope the “connect interval” have done the trick. I also switched off the “BT: Connect to devices option”.

I am afraid it is still unreliable. It usually works when powering on/off the device. However, it does not work always, but almost always. On top of that, when the device is moved away from the gateway instead of powering it off, it usually stays online for unknown reason. Honestly, I am not sure whether there is an actual difference because everything is quite random.

I just purchased a Tile device to check whether there is any difference on its behaviour:

https://amzn.eu/d/d9zU8Wn

Let’s see if I can at least see any difference which helps to narrod down the problem.

The Tile seems to work much better in terms of status updates. Both online and offline states are updated according to the actual position/status of the beacon. However, the specific model I purchased has a very narrow coverage. If the beacon is a few meters away from the gateway, it changes from/to online/offline with a very high frequency. Besides, this beacon requires subscription for basic functions, so I will return it.

I will have to continue looking for a good beacon. Any suggestion?

Both your Feasycom and iTag beacons should be fine for usage as a Home/Away device tracker. And my version of the iTag does work correctly here with the latest development OpenMQTTGateway version, as well as other beacons I use.

If it doesn’t always correctly recognise the Away status for you, are you waiting long enough to confirm the away message? At least 3 minutes, with your 2 minute tracker timeout setting, but also the intervals of 55 seconds with the 10 second scan window it could well take around 3 minutes before the status:offline message is being sent to set the status to Away.

If you’d want to shorten any of this, you can turn BT: Adaptive Scan OFF, set both BT intervals to 20 seconds and keep the 2 minute tracker timeout and the 10 s scan duration.

Sometimes it never updates to away status. I’ve waited a few hours.

Are you using a white-list with your OpenMQTTGateway gateway?

Nop. Should I?

No, just wondering if that might cause an issue for you, but no need for one at all.

Could you try with the latest development version avaialble at the above development test link, to see if it still happens for you?