miflora-mqtt-daemon icon indicating copy to clipboard operation
miflora-mqtt-daemon copied to clipboard

Enhancement: Provide mqtt information if connection to sensor failed or failed to retrieve data fro sensor.

Open wojciej opened this issue 5 years ago β€’ 4 comments

Hello, Scenario: MiFlora work for some time and returns data but battery goes off and data stop to flow.

Openhab display value last returned over mqtt. User newer knows that sensor is offline.

I would like to propose enhancement: In the event of lost connectivity to the sensor or failure to retrieve data, deamon could returned either "N/A" or "connection lost" value in all measurements for lost sensor.

Do you think it would be possible ?

Thanks Jarek

wojciej avatar Feb 15 '19 13:02 wojciej

It is possible to add topic "timestamp" for device. And in openhab write a rule that checks last timestamp... This is already done for some mqtt conventions in daemon.

aqualx avatar Feb 15 '19 13:02 aqualx

Adding a timestamp is one way to go but then as you have mentioned, we would need another thing (rule) in openhab to check timestemp, while adding N/A or connection lost to a toppic would give user general idea of what have happened without additional rules in openhab.

wojciej avatar Feb 17 '19 17:02 wojciej

I have rethink this:

  • adding a timestamp would be great to get information when data where gathered
  • then on top of that - updating toppic with N/A or connection lost if timer would not be available.

wojciej avatar Feb 17 '19 17:02 wojciej

@wojciej I have something like this kinda-sorta working in my branch https://github.com/insertjokehere/miflora-mqtt-daemon/tree/device_registry - it sets an availability topic in the home assistant discovery message. Currently all sensors that the daemon have discovered are marked as "available" if the daemon is up and connected; I've not implemented any logic around detecting if a specific sensor hasn't been contacted in a while

insertjokehere avatar Jul 29 '19 00:07 insertjokehere