Create a delay to stabilze a switch

Thanks in advance im just new to Node Red.
Its hard to give this a title, but what i have is a 4 switches controlled by heartrate.
but i only want to change the switch once it has been within a range for 5 seconds
In Home Assistant i was able to do this with a delay but when i use a delay in node red i get delays in the function rather than the state.

Maybe something like...

TttuUP50tg

[{"id":"02692201b0297f2b","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"100","payloadType":"num","x":1290,"y":1200,"wires":[["63351327eee9e2c6"]]},{"id":"06a20cd953d78df7","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"140","payloadType":"num","x":1290,"y":1280,"wires":[["63351327eee9e2c6"]]},{"id":"29819d5115a9b4e4","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"180","payloadType":"num","x":1290,"y":1320,"wires":[["63351327eee9e2c6"]]},{"id":"780620e45c6c7191","type":"trigger","z":"1683bd9a.5e0a02","name":"","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"5","extend":false,"overrideDelay":false,"units":"s","reset":"reset","bytopic":"all","topic":"topic","outputs":1,"x":1740,"y":1260,"wires":[["12fd30e396a846a6"]]},{"id":"63351327eee9e2c6","type":"switch","z":"1683bd9a.5e0a02","name":"between 120 ~ 160?","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"110","vt":"num","v2":"170","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1500,"y":1260,"wires":[["780620e45c6c7191"],["f8b4e435485bafc6"]]},{"id":"c1618f6dd36d6daf","type":"inject","z":"1683bd9a.5e0a02","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"130","payloadType":"num","x":1290,"y":1240,"wires":[["63351327eee9e2c6"]]},{"id":"f8b4e435485bafc6","type":"change","z":"1683bd9a.5e0a02","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1630,"y":1320,"wires":[["780620e45c6c7191"]]},{"id":"12fd30e396a846a6","type":"debug","z":"1683bd9a.5e0a02","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1920,"y":1260,"wires":[]}]

thanks for the reply, your answer looks intersting , but i havent a clue on how to introduce it as i have 5 outputs from the switch

The simple way is to replicate the flow four times for your four ranges.

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