I have two OMGs and one TheengsGateway I want to use for presence detection for a specific BLE device.
For this I have this sensor (multiple times of course):
- name: "E-Bike (OMG 1)"
unique_id: xyzxyzxyz
state_topic: "OpenMQTTGateway/presence/ESP_OMG_1"
value_template: "{{ 'home' if value_json.id == 'XX:XX:XX:XX:XX:XX' else 'not_home' }}"
#expire_after: 10
icon: mdi:bicycle-electric
device:
identifiers: XYZ
entity_category: diagnostic
While this seems (!) to basically work, it seems like the presence topic for OMG and TheengsGateway is very different to the one I used before in another ESP based project (where the state topic contained a list of all devices currenctly around, so as long as the device was active it was part of the state topic, that way it was discovered âhomeâ as long as it was nearby):
the topic only stores the latest device found, for a very short period of time (depending on the next new/strongest one detected).
Multiple discovery doesnât matter as I have one collection sensor (contains OMG 1 + OMG 2 + TG + WiFi based sensor + previous Bluetooth sensors).
In short: how to use the OMG/TheengsGateway provided presence topics for doing some half-serious (no device_tracker
entities needed at the end, but reliable discovery and ideally signaling how long the device is around) device tracking?
I know you natively implemented this in a very professional way (meaning in the end thereâs a autodiscovery provided device_tracker
entity in Home Assistant, just perfect) for many devices (BM2, fitness trackers etc.). Would this be âthe way to go to do it fully professionalâ?
Iâm currently looking at the best way to go. Focus:
- reliability
- speed (I canât wait months to have this natively implemented and shipped in a stable OMG/TG release, thatâs why I tried to use what I can with the existing MQTT topics)
Thanks a lot for your help on this. Unfortunately I found that doing device tracking on my own is quite complicated with bluetooth devices and the way the presence topics are build (ultra short-term lifetime/no list as I was used to).