Hi,
I am using a delay timer in node red attached to a motion sensor, and need to cancel this timer if motion is detected during this time out period.
I have a motion detected, and motion ended input from a Shelly device.
[{"id":"a3a21d2e40b021ad","type":"tab","label":"Temp Data","disabled":false,"info":"","env":[]},{"id":"6ef5cb52085196a9","type":"switch","z":"a3a21d2e40b021ad","name":"","property":"payload.event","propertyType":"msg","rules":[{"t":"eq","v":"S","vt":"str"},{"t":"eq","v":"SS","vt":"str"},{"t":"eq","v":"SSS","vt":"str"},{"t":"eq","v":"L","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":210,"y":240,"wires":[["78b159ff6c9b9fcf"],["b877a68bdb41a353"],[],["51f40e09fa7f2066"]]},{"id":"fcd881903c5e1253","type":"switch","z":"a3a21d2e40b021ad","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"},{"t":"eq","v":"1","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":210,"y":100,"wires":[["4508736a0fd60689"],["b4b105d726be5caf","3e1aaa7007d97944"]]},{"id":"4508736a0fd60689","type":"api-current-state","z":"a3a21d2e40b021ad","name":"Sensor Timer On","server":"2278bc1a32e13768","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.sensor_timer","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":390,"y":80,"wires":[["6fc78f4faba6d403"],[]]},{"id":"51f40e09fa7f2066","type":"api-call-service","z":"a3a21d2e40b021ad","name":"DS-SR Off","server":"2278bc1a32e13768","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.downstairs_shower_room_all"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":450,"y":340,"wires":[[]]},{"id":"f49452dc6b0db99e","type":"api-call-service","z":"a3a21d2e40b021ad","name":"DS-SR select next scene","server":"2278bc1a32e13768","version":5,"debugenabled":false,"domain":"input_select","service":"select_next","areaId":[],"deviceId":[],"entityId":["input_select.ds_sr_scene_selection"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":670,"y":260,"wires":[[]]},{"id":"69b8836d896e292a","type":"api-call-service","z":"a3a21d2e40b021ad","name":"DS-SR select scene 1","server":"2278bc1a32e13768","version":5,"debugenabled":false,"domain":"input_select","service":"select_option","areaId":[],"deviceId":[],"entityId":["input_select.ds_sr_scene_selection"],"data":"{\"option\":\"Scene 1\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":660,"y":220,"wires":[[]]},{"id":"78b159ff6c9b9fcf","type":"api-current-state","z":"a3a21d2e40b021ad","name":"Switch Loop","server":"2278bc1a32e13768","version":3,"outputs":2,"halt_if":"Scene 2","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.ds_sr_scene_selection","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":450,"y":240,"wires":[["69b8836d896e292a"],["f49452dc6b0db99e"]]},{"id":"6fc78f4faba6d403","type":"delay","z":"a3a21d2e40b021ad","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":600,"y":80,"wires":[["51f40e09fa7f2066"]]},{"id":"b877a68bdb41a353","type":"api-call-service","z":"a3a21d2e40b021ad","name":"Fan On","server":"2278bc1a32e13768","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.downstairs_shower_room_fan"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":440,"y":300,"wires":[["21012d4882123562"]]},{"id":"21012d4882123562","type":"delay","z":"a3a21d2e40b021ad","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":600,"y":300,"wires":[["45709be8cc69dd13"]]},{"id":"45709be8cc69dd13","type":"api-current-state","z":"a3a21d2e40b021ad","name":"Lights On","server":"2278bc1a32e13768","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.downstairs_shower_room_downlights","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":740,"y":300,"wires":[[],["afff630dae2a2703"]]},{"id":"afff630dae2a2703","type":"api-call-service","z":"a3a21d2e40b021ad","name":"Fan Off","server":"2278bc1a32e13768","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.downstairs_shower_room_fan"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":900,"y":300,"wires":[[]]},{"id":"b4b105d726be5caf","type":"api-current-state","z":"a3a21d2e40b021ad","name":"Sensor Timer On","server":"2278bc1a32e13768","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.sensor_timer","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":390,"y":120,"wires":[["69b8836d896e292a"],[]]},{"id":"3e1aaa7007d97944","type":"function","z":"a3a21d2e40b021ad","name":"This needs to cancel timer??","func":"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":400,"y":180,"wires":[["6fc78f4faba6d403"]]},{"id":"2278bc1a32e13768","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]
The part that says “This needs to cancel timer??” is where i need to send a reset command.
Any ideas?
Thanks All.