Node to trigger if a state is certain amount of time

Hi, I have a ESP presence sensor I'm wanting to monitor the state. If the state is "Clearance" for at least 3 minutes I want it too send a payload to turn off the lights. Is there a node anyone knows of that can do that?

image

Trigger Node.

You can also cancel it at will

@marcus-j-davies thank you for the suggestion, but I was trying to test this out and it might not work for my scenario. Sorry forgot to include this, but the state flips between "Movement" and "Occupancy" I need a way for it too check that state "Clearance" has been 3 minutes and not changed to "Movement" or "Occupancy".

Still, its all there.

You can cancel the trigger (msg.reset = true) the moment it moves away from Clearance

[{"id":"95e74b90d287852b","type":"trigger","z":"82a9dc95c5200a1f","name":"","op1":"","op2":"0","op1type":"nul","op2type":"str","duration":"3","extend":false,"overrideDelay":false,"units":"min","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":710,"y":240,"wires":[[]]},{"id":"da419234bfad6199","type":"function","z":"82a9dc95c5200a1f","name":"My Sensor","func":"\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":110,"y":280,"wires":[["6aa4fabf26512a04"]]},{"id":"6aa4fabf26512a04","type":"switch","z":"82a9dc95c5200a1f","name":"Clearance?","property":"payload.myState","propertyType":"msg","rules":[{"t":"eq","v":"Clearance","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":280,"wires":[["2fd84c1bfd59066c"],["a82d85be702edaa6"]]},{"id":"a82d85be702edaa6","type":"change","z":"82a9dc95c5200a1f","name":"msg.reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":340,"wires":[["95e74b90d287852b"]]},{"id":"2fd84c1bfd59066c","type":"junction","z":"82a9dc95c5200a1f","x":440,"y":240,"wires":[["95e74b90d287852b"]]}]
2 Likes

@marcus-j-davies genius! I see what your doing now. Thank you very much!

1 Like

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