Monitoring of change of value

Hi all,

I have power-values available in Nodered, that I store in a database. I want to use this power-values to monitor a special event: if everything works fine, the value changes each 5 min or so for a certain amount (it looks a bit like a rectangle signal. In the case of a malfunction, the value stays more or less constant (within tolerances). How to catch this situation to trigger a message? The value itself can vary in size, so this has to be variable. So the goal is that a certain value hasnā€˜t changed within limits during a time-period...
Any ideas? I managed to get it otherway round, so to get messages, if the value changed, but vise versa?

Hi GTiglio!

What kind of database are you using? If you use influxdb you can use the spread function to get the difference between min and max values: spread() function | InfluxDB Cloud Documentation

You can query the last 5 minutes and if the spread is below a certain threshold you send a message

Hi Simon,
thanks for quick reply.
Iā€˜m using an Influx-DB. I receive the data via MQTT, process these in NodeRed and push them in the database. So I have the values available prior to have them in the DB. Ok, I could read it from the database again, but I guess in my case it is better to recognise this event with the data coming coming via MQTT with the right nodes?

You can use your 'otherway round' message which indicates a large change and feed that into a Trigger node set to Send Nothing then wait for the required time, Extend delay on new message and then Send your 'unchanged' message. The effect is that no message will be sent provided the changed messages keep coming in, but if they stop for the configured time then the message will be sent. The wait time can be dynamic by including it in msg.delay in the incoming messages.

1 Like

Thanks Colin, that was the missing detail!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.