Data from failed sensor

#1

Hi, i have been playing around with ESP8266 sending data to MQTT server and a dashboard displaying the data in Node Red. It all works great. I only have one issue, that is if the sensor stops working the dashboard continues to display the last published reading. Is there any way to indicate that the sensor has stopped sending?????

0 Likes

#2

You can store last update time into context and periodically check this time against current time. If time difference is bigger, than you like, rise alert.

0 Likes

#3

Or you can use the trigger node.

You can set it to Send the existing msg object
set the then wait for time to be greater than the period between sensor updates.

select extend delay if new message arrives
and create your error message in then send

1 Like

#4

Or if using MQTT then you could set up an LWT message to send a blank as a value (I think that will clear a gauge for instance)

0 Likes

#5

Yep I am using MQTT. Can you explain more?

0 Likes

#6

probably best go read - https://www.hivemq.com/blog/mqtt-essentials-part-9-last-will-and-testament

0 Likes

#7

There is one catch. Well it may depend on what kind of firmware you are running on your ESP8266, and how to you set up you subscribers and so.

I'll take the tasmota firmware for example as I have some experiences with it.
So you are listening the telemetry (tele/) and your ESP runs perfectly, you have periodical update, but if connected sensor has some problems, the data will then carry no sensor data in it. By checking only if the data come in, may produce false positive in such cases.

For a bit more reliable solution - whatever kind of timer control is created over the sensor updates, it will be reset only after parsing the data and sensor part in it is validated.

And things can go much more complicated, if you are connecting more than one sensor to your ESP and they start to fail one by one. Sometimes. Randomly.

:wink:

0 Likes

#8

Hi ukmoose, I went with the trigger node.

I now have a text box which indicates ONLINE and OFFLINE, works great.

Thanks for the help

1 Like