Trigger output if value unchanged for X amount of time

Hello!

I have a numerical sensor value Node-Red is reading from an MQTT topic.

Unfortunately the script writing the MQTT topic freezes at times. This flow needs to be stopped if that happens!

I'd like to be able to trigger an alternative flow output if the Node-Red flow sees any numerical value hang for longer than say 10 minutes....

Any pointers?

Cheers folks

The trigger node is the one to try out for this sort of thing

1 Like

Yep maybe a RBE node before a trigger node - so values will go through to the trigger node (assuming they change) and then have a timeout on the trigger of say 10 minutes so if no new readings come through in that time the next action happens

Obviously if the script is running and sending the same value over and over then this will not work

(although you could look for a different property in the MQTT stream like time or some such i.e. something that you set in the script that will change each time)

Craig

1 Like

It's definitely a starting point, I will take a look at that this eve.
Thanks for taking the time to reply chaps!

Thanks!
Here's a sample flow for anyone looking for a similar action.

[{"id":"300bbb3b.7456fc","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"d2476c1.5c1691","type":"rbe","z":"300bbb3b.7456fc","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":290,"y":220,"wires":[["3d3cd101.6761f6","182c7bc.dab3804"]]},{"id":"3d3cd101.6761f6","type":"trigger","z":"300bbb3b.7456fc","op1":"","op2":"HUNG","op1type":"pay","op2type":"str","duration":"30","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":470,"y":140,"wires":[["1867f9f9.ae21d6"]]},{"id":"1867f9f9.ae21d6","type":"switch","z":"300bbb3b.7456fc","name":"HUNG","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"HUNG","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":610,"y":140,"wires":[["615719ef.3a6ba8"]]},{"id":"2ddd6e48.a9e382","type":"inject","z":"300bbb3b.7456fc","name":"","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":160,"wires":[["d2476c1.5c1691"]]},{"id":"f74ac156.c87748","type":"inject","z":"300bbb3b.7456fc","name":"","topic":"","payload":"2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108.75,"y":218.75,"wires":[["d2476c1.5c1691"]]},{"id":"c7acbbdd.bc6d4","type":"inject","z":"300bbb3b.7456fc","name":"","topic":"","payload":"3","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":280,"wires":[["d2476c1.5c1691"]]},{"id":"182c7bc.dab3804","type":"debug","z":"300bbb3b.7456fc","name":"Flow into usual working process","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":530,"y":220,"wires":[]},{"id":"615719ef.3a6ba8","type":"debug","z":"300bbb3b.7456fc","name":"\"Hung\" Action flow trigger","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":820,"y":140,"wires":[]}]
1 Like

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