BLE device availability

I connected a couple of Xiaomi Mijia BLE thermometers to openHAB using OpenMQTTGateway and they were successfully detected and configured. But when I remove the battery on one of them, the previous value stales ant the device is not reported as missing. On the MQTT broker I can see, that the last message is old as expected.
What’s the concept of missing device in OpenMQTTGateway? Does it report it as missing after not receiving any data after a certain amount of time? How does it report a missing device to openHAB?
Many thanks for your hints.
Cheers,
Pete

Hi Pete,

There is no concept of missing devices in OpenMQTTGateway.

OpenMQTTGateway reports the BLE broadcasting of device in the vicinity, decodes their broadcasts if they are known devices, otherwise publishes their raw data. As you saw in your broker messages, OMG stops publishing new messages if a device has been switched off or has left the bluetooth range of the gateway.

Any such missing occurrences need to be handled in the controller receiving the MQTT messages, OpenHAB in your case.

For example, if the controller stops receiving messages from a BLE Beacon which is on a key chain, it knows you left the house, and it could activate the alarm system.

If a beacon in your car stops sending messages while your key chain beacon is still present and sending, you know someone else is stealing your car … and so on.

All in all, missing messages need to be handled in the controller, much the same as the properties of the messages themselves, like when the battery property gets below a certain threshold etc.

Hope this helps to clarify things.

P.S. With OpenHAB you might want to look into the expire functionality to define after what time of an item not being updated you want an action to be taken.

Hi Digi,
Many thanks for your reply, exactly what I was looking for.
In OpenHAB it’s on the Item, click “Add Metadata” and then choose “Expiration Timer”.
Cheers,
Pete