Problem with PIR en Lamp

Hello all,

I'm trying to make a circuit but it won't work.
The idea is that a PIR switches on a lamp and switches it off after 4 minutes. This is no problem. I want to ensure that as soon as the PIR is triggered within those 4 minutes, the 4 minutes start again and the lamp remains switched on.

Is there anyone who can help me on my way?
Thanx, Peter

[{"id":"f4f108b3d1b16c74","type":"api-call-service","z":"9f4551bd2427ec57","name":"Testlam aan","server":"3c6b2d2d.b63e72","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.dimmable_light_29"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":570,"y":2200,"wires":[["fa4f708f4fdbeb1c"]]},{"id":"32f3e9316a49328e","type":"server-state-changed","z":"9f4551bd2427ec57","name":"Motion M1 bijkeuken","server":"3c6b2d2d.b63e72","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"binary_sensor.hue_motion_sensor_1_motion","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"on","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":false,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":2175,"wires":[["285142e67e4bf3b2"],[]]},{"id":"285142e67e4bf3b2","type":"api-current-state","z":"9f4551bd2427ec57","name":"testlam is on","server":"3c6b2d2d.b63e72","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.dimmable_light_29","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":370,"y":2175,"wires":[["f2a21d89984aaf46"],["f4f108b3d1b16c74"]]},{"id":"c70dbc3237166de9","type":"api-call-service","z":"9f4551bd2427ec57","name":"Testlam uit","server":"3c6b2d2d.b63e72","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.dimmable_light_29"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":995,"y":2175,"wires":[[]]},{"id":"f2a21d89984aaf46","type":"function","z":"9f4551bd2427ec57","name":"delay 3000","func":"\n\n//msg.payload = totaal_geconsumeerd;\nmsg.delay = 60000*6;\nreturn msg;","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":570,"y":2150,"wires":[["fa4f708f4fdbeb1c"]]},{"id":"fa4f708f4fdbeb1c","type":"delay","z":"9f4551bd2427ec57","name":"4 min","pauseType":"delayv","timeout":"4","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":true,"outputs":1,"x":800,"y":2175,"wires":[["c70dbc3237166de9"]]},{"id":"3c6b2d2d.b63e72","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

Hi, not tried your flow but it is the Trigger node that you want to look at:

Note the flag that extends the delay if another message is received.

Dear Julian,

With your help we made it happen. I had already spent a day trying to get it done. Thanks a lot for the help!!

Regards,
Peter

1 Like

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