A handy little routine/flow to monitor for sustained values over a time

Instructions in the comment nodes indicated with a *.

As is, it is set to the extremes, so may not be too handy, but it easily editable.

Concept:

You are getting data coming in (values/numbers) that have a range.
In this example 0 -> 100

0 is not useful.
100 is also not too helpful.

So the idea is that if signals (messages) are received for (say) 40 seconds that are between 1 and 99 (inclusive) you will get an output.

Sorry I didn't set anything in the output node. Too variable.

You can adjust the acceptable range by editing the switch node.
The middle output is the acceptable range.
The first and last outputs are outside acceptable values and are needed to be used.

If a value is outside the range, the outputs are taken to a change node and a reset message is constructed and resets the trigger node.

The trigger node is to be edited for the time period you wish the values to be covered.
(Obviously the more signals the better)

I know there are nodes that could do this similar.
But for the point of sharing and helping people: here is a small flow (routine) to do just that.

[{"id":"f62cfcc1.ecaa38","type":"trigger","z":"68e3655f.b606b4","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"40","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":530,"y":1680,"wires":[["eeeb3617.de0668","20244a41.1c6a86"]]},{"id":"621af0cb.13e2c","type":"switch","z":"68e3655f.b606b4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"gt","v":"0","vt":"num"},{"t":"eq","v":"100","vt":"num"}],"checkall":"true","repair":false,"outputs":3,"x":330,"y":1680,"wires":[["cabd0990.6a169"],["f62cfcc1.ecaa38"],["cabd0990.6a169"]]},{"id":"cabd0990.6a169","type":"change","z":"68e3655f.b606b4","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":1760,"wires":[["f62cfcc1.ecaa38","7e940055.b8258"]]},{"id":"eeeb3617.de0668","type":"debug","z":"68e3655f.b606b4","name":"Sustained signal received.","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":1640,"wires":[]},{"id":"7e940055.b8258","type":"trigger","z":"68e3655f.b606b4","op1":"1","op2":"0","op1type":"str","op2type":"str","duration":"1","extend":false,"units":"s","reset":"","bytopic":"all","name":"Reset indicator","x":540,"y":1760,"wires":[[]]},{"id":"8999443b.debb08","type":"comment","z":"68e3655f.b606b4","name":"Sustained health indicator *","info":"Used to detect ongoing signals that are acceptable for health.\n\nEdit the `switch` node for the range.\nand edit the `trigger` node for how long it needs to be valid.\n","x":460,"y":1600,"wires":[]},{"id":"cfb2511d.b8ba98","type":"function","z":"68e3655f.b606b4","name":"Input","func":"\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":1680,"wires":[["621af0cb.13e2c"]]},{"id":"c3e4902d.4afc48","type":"comment","z":"68e3655f.b606b4","name":"Optional *","info":"This node is just if you want to see what's going on from the edit screen if there are signals received that are resetting the `trigger` node.","x":530,"y":1720,"wires":[]},{"id":"20244a41.1c6a86","type":"function","z":"68e3655f.b606b4","name":"Output","func":"\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":1680,"wires":[[]]}]

This topic was automatically closed after 60 days. New replies are no longer allowed.