Problem with a Node

Hello

i ve a problem with my node. the motions sensor should switch on my light and after
30 min, if no motion is detected, my light should go off.

lights on works, but my light dont go off. dont know why.

[{“id”:“f837b5f.5377148”,“type”:“tab”,“label”:“Motion”,“disabled”:false,“info”:“”},{“id”:“b2972323.b788c”,“type”:“stoptimer”,“z”:“f837b5f.5377148”,“duration”:“30”,“units”:“Minute”,“payloadtype”:“num”,“payloadval”:“0”,“name”:“30min”,“x”:710,“y”:360,“wires”:[[“1661b7ae.4c2538”],]},{“id”:“c85866ea.d067f8”,“type”:“switch”,“z”:“f837b5f.5377148”,“name”:“”,“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“on”,“vt”:“str”},{“t”:“eq”,“v”:“off”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:410,“y”:240,“wires”:[[“4a3f3d58.f3e4a4”],[“b2972323.b788c”]]},{“id”:“30917c95.8b7694”,“type”:“server-state-changed”,“z”:“f837b5f.5377148”,“name”:“Motion”,“server”:“d635031d.ddc2a”,“version”:1,“exposeToHomeAssistant”:false,“haConfig”:[{“property”:“name”,“value”:“”},{“property”:“icon”,“value”:“”}],“entityidfilter”:“binary_sensor.partyraum_theke_bewegungsmelder_occupancy”,“entityidfiltertype”:“exact”,“outputinitially”:false,“state_type”:“str”,“haltifstate”:“on”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“outputs”:2,“output_only_on_state_change”:false,“for”:0,“forType”:“num”,“forUnits”:“minutes”,“ignorePrevStateNull”:false,“ignorePrevStateUnknown”:false,“ignorePrevStateUnavailable”:false,“ignoreCurrentStateUnknown”:false,“ignoreCurrentStateUnavailable”:false,“x”:170,“y”:240,“wires”:[[“c85866ea.d067f8”,“aba2dcb5.79d24”],]},{“id”:“f041e811.20da18”,“type”:“api-call-service”,“z”:“f837b5f.5377148”,“name”:“Light on”,“server”:“d635031d.ddc2a”,“version”:1,“debugenabled”:false,“service_domain”:“switch”,“service”:“turn_on”,“entityId”:“switch.partyraum_theke”,“data”:“”,“dataType”:“jsonata”,“mergecontext”:“”,“output_location”:“”,“output_location_type”:“none”,“mustacheAltTags”:false,“x”:920,“y”:200,“wires”:[]},{“id”:“1661b7ae.4c2538”,“type”:“api-call-service”,“z”:“f837b5f.5377148”,“name”:“Light off”,“server”:“d635031d.ddc2a”,“version”:1,“debugenabled”:false,“service_domain”:“switch”,“service”:“turn_off”,“entityId”:“switch.partyraum_theke”,“data”:“”,“dataType”:“jsonata”,“mergecontext”:“”,“output_location”:“”,“output_location_type”:“none”,“mustacheAltTags”:false,“x”:960,“y”:360,“wires”:[]},{“id”:“4a3f3d58.f3e4a4”,“type”:“api-current-state”,“z”:“f837b5f.5377148”,“name”:“Light on?”,“server”:“d635031d.ddc2a”,“version”:1,“outputs”:2,“halt_if”:“on”,“halt_if_type”:“str”,“halt_if_compare”:“is”,“override_topic”:false,“entity_id”:“switch.partyraum_theke”,“state_type”:“str”,“state_location”:“payload”,“override_payload”:“msg”,“entity_location”:“data”,“override_data”:“msg”,“blockInputOverrides”:false,“x”:660,“y”:200,“wires”:[,[“f041e811.20da18”]]},{“id”:“bb0f23ce.e7fee”,“type”:“switch”,“z”:“f837b5f.5377148”,“name”:“stop timer”,“property”:“payload”,“propertyType”:“msg”,“rules”:[{“t”:“eq”,“v”:“stop”,“vt”:“str”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:400,“y”:420,“wires”:[[“b2972323.b788c”]]},{“id”:“aba2dcb5.79d24”,“type”:“stoptimer”,“z”:“f837b5f.5377148”,“duration”:“10”,“units”:“Second”,“payloadtype”:“num”,“payloadval”:“0”,“name”:“10s”,“x”:250,“y”:420,“wires”:[[“bb0f23ce.e7fee”],]},{“id”:“d635031d.ddc2a”,“type”:“server”,“name”:“Home Assistant”,“addon”:true}]

You must properly format your code in the forum else it can’t be properly copied by others.

select the code and press:
image

ok

[{"id":"eca5245a.eb1bc8","type":"stoptimer","z":"61551e6a.0d02c","duration":"30","units":"Minute","payloadtype":"num","payloadval":"0","name":"30min","x":710,"y":720,"wires":[["b22349e0.063728"],[]]},{"id":"a03cce3c.ee7cc","type":"switch","z":"61551e6a.0d02c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":410,"y":600,"wires":[["1326a0bd.a5b16f"],["eca5245a.eb1bc8"]]},{"id":"a2a6e9dc.dba4c8","type":"server-state-changed","z":"61551e6a.0d02c","name":"Motion","server":"d635031d.ddc2a","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.partyraum_theke_bewegungsmelder_occupancy","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":170,"y":600,"wires":[["a03cce3c.ee7cc","43885e84.dd31a"],[]]},{"id":"ff59a3fb.87b15","type":"api-call-service","z":"61551e6a.0d02c","name":"Light on","server":"d635031d.ddc2a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.partyraum_theke","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":920,"y":560,"wires":[[]]},{"id":"b22349e0.063728","type":"api-call-service","z":"61551e6a.0d02c","name":"Light off","server":"d635031d.ddc2a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.partyraum_theke","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":960,"y":720,"wires":[[]]},{"id":"1326a0bd.a5b16f","type":"api-current-state","z":"61551e6a.0d02c","name":"Light on?","server":"d635031d.ddc2a","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.partyraum_theke","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":660,"y":560,"wires":[[],["ff59a3fb.87b15"]]},{"id":"30c19f6a.37e72","type":"switch","z":"61551e6a.0d02c","name":"stop timer","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"stop","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":400,"y":780,"wires":[["eca5245a.eb1bc8"]]},{"id":"43885e84.dd31a","type":"stoptimer","z":"61551e6a.0d02c","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"10s","x":250,"y":780,"wires":[["30c19f6a.37e72"],[]]},{"id":"d635031d.ddc2a","type":"server","name":"Home Assistant","addon":true}]

that works.

You have a node sending out “on” only:
image

try this:
[{"id":"eca5245a.eb1bc8","type":"stoptimer","z":"fca6d7f7.a0b588","duration":"30","units":"Minute","payloadtype":"num","payloadval":"0","name":"30min","x":1170,"y":680,"wires":[["b22349e0.063728"],[]]},{"id":"a2a6e9dc.dba4c8","type":"server-state-changed","z":"fca6d7f7.a0b588","name":"Motion","server":"d635031d.ddc2a","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.partyraum_theke_bewegungsmelder_occupancy","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":630,"y":560,"wires":[["43885e84.dd31a","1326a0bd.a5b16f"],["eca5245a.eb1bc8"]]},{"id":"ff59a3fb.87b15","type":"api-call-service","z":"fca6d7f7.a0b588","name":"Light on","server":"d635031d.ddc2a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.partyraum_theke","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1380,"y":520,"wires":[[]]},{"id":"b22349e0.063728","type":"api-call-service","z":"fca6d7f7.a0b588","name":"Light off","server":"d635031d.ddc2a","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.partyraum_theke","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1420,"y":680,"wires":[[]]},{"id":"1326a0bd.a5b16f","type":"api-current-state","z":"fca6d7f7.a0b588","name":"Light on?","server":"d635031d.ddc2a","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.partyraum_theke","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1120,"y":520,"wires":[[],["ff59a3fb.87b15"]]},{"id":"30c19f6a.37e72","type":"switch","z":"fca6d7f7.a0b588","name":"stop timer","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"stop","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":860,"y":740,"wires":[["eca5245a.eb1bc8"]]},{"id":"43885e84.dd31a","type":"stoptimer","z":"fca6d7f7.a0b588","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"10s","x":710,"y":740,"wires":[["30c19f6a.37e72"],[]]},{"id":"d635031d.ddc2a","type":"server","name":"Home Assistant","addon":true}]

1 Like

i ll try your code. thx

I have solved this a little bit different. I don’t want the light to turn off when I turn it on manual. I also want to restart the timer if motion is detected again. And I only want to turn on the light automatic when my solar panels produce little or none power.

My code (or nodes ;-):

[{"id":"460d2706.b8a788","type":"server-state-changed","z":"f22a73e7.cafd7","name":"Garage PIR","server":"3f53ed1d.fd3d32","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.beneden_voordeur_input","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":false,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":70,"y":260,"wires":[["d31b129d.0eee6","21f2bdd.b83b542","2e589ab9.b4e966"],["76dfc473.0e994c"]]},{"id":"75f3a32b.9f05fc","type":"api-call-service","z":"f22a73e7.cafd7","name":"Garage Licht","server":"3f53ed1d.fd3d32","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.garage_plafond","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":750,"y":160,"wires":[[]]},{"id":"3a6efc13.e654b4","type":"api-call-service","z":"f22a73e7.cafd7","name":"Garage Licht","server":"3f53ed1d.fd3d32","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.garage_plafond","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":750,"y":340,"wires":[[]]},{"id":"76dfc473.0e994c","type":"delay","z":"f22a73e7.cafd7","name":"","pauseType":"delay","timeout":"60","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":340,"y":340,"wires":[["9236e99c.ef4f68"]]},{"id":"20cbf2d9.d50dfe","type":"api-current-state","z":"f22a73e7.cafd7","name":"Plafond al aan?","server":"3f53ed1d.fd3d32","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.garage_plafond","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":520,"y":160,"wires":[[],["75f3a32b.9f05fc","81b23aeb.7355c8"]]},{"id":"9236e99c.ef4f68","type":"traffic","z":"f22a73e7.cafd7","name":"Stoplicht","property_allow":"payload","filter_allow":"groen","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"rood","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":580,"y":340,"wires":[["3a6efc13.e654b4","2fe7b6ed.3b6baa"]]},{"id":"81b23aeb.7355c8","type":"change","z":"f22a73e7.cafd7","name":"Groen","rules":[{"t":"set","p":"payload","pt":"msg","to":"groen","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":260,"wires":[["9236e99c.ef4f68"]]},{"id":"2fe7b6ed.3b6baa","type":"change","z":"f22a73e7.cafd7","name":"Rood","rules":[{"t":"set","p":"payload","pt":"msg","to":"rood","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":420,"wires":[["9236e99c.ef4f68"]]},{"id":"d31b129d.0eee6","type":"change","z":"f22a73e7.cafd7","name":"Reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":260,"wires":[["76dfc473.0e994c"]]},{"id":"21f2bdd.b83b542","type":"api-current-state","z":"f22a73e7.cafd7","name":"Is er weinig licht?","server":"3f53ed1d.fd3d32","version":1,"outputs":2,"halt_if":"50","halt_if_type":"num","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.pv_power","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":290,"y":160,"wires":[["20cbf2d9.d50dfe"],[]]},{"id":"2e589ab9.b4e966","type":"api-current-state","z":"f22a73e7.cafd7","name":"Is er weinig licht?","server":"3f53ed1d.fd3d32","version":1,"outputs":2,"halt_if":"unknown","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.pv_power","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":290,"y":100,"wires":[["20cbf2d9.d50dfe"],[]]},{"id":"3f53ed1d.fd3d32","type":"server","name":"Home Assistant","addon":true}]

If we start showing off :slight_smile:

[{"id":"f3d1d2cb.118008","type":"group","z":"ae9b31fa.990e9","style":{"stroke":"#2e333a","stroke-opacity":"1","fill":"#2e333a","fill-opacity":"0.75","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["ebaa5af4.096e68","ecb56999.00456","d3e6071b.ea2bb8","c9e22b0a.934418","2f8e0a09.4857de","955ccaa2.492828","4784b10d.8c1418","f87f1d9f.036a7"],"x":1494,"y":1279,"w":1312,"h":202},{"id":"ebaa5af4.096e68","type":"server-state-changed","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","name":"Beweging Kantoor","server":"c6b350c5.b8b3c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.nas_pd02z_battery_powered_pir_sensor_v2_home_security_motion_detected_4","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":1610,"y":1400,"wires":[["d3e6071b.ea2bb8","c9e22b0a.934418"],[]]},{"id":"ecb56999.00456","type":"api-call-service","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","name":"","server":"c6b350c5.b8b3c","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.relay_1_relay_3","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":2150,"y":1380,"wires":[["f87f1d9f.036a7"]]},{"id":"d3e6071b.ea2bb8","type":"api-current-state","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","name":"Lux Kantoor <24?","server":"c6b350c5.b8b3c","version":1,"outputs":2,"halt_if":"24","halt_if_type":"num","halt_if_compare":"lt","override_topic":false,"entity_id":"sensor.nas_pd02z_battery_powered_pir_sensor_v2_illuminance_4","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1890,"y":1380,"wires":[["ecb56999.00456"],[]]},{"id":"c9e22b0a.934418","type":"api-current-state","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","name":"Lamp aan?","server":"c6b350c5.b8b3c","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.relay_1_relay_3","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":2070,"y":1440,"wires":[["f87f1d9f.036a7"],[]]},{"id":"2f8e0a09.4857de","type":"comment","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","name":"Beweging in Kantoor Lamp aan","info":"","x":1650,"y":1340,"wires":[]},{"id":"955ccaa2.492828","type":"delay","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"hours","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":2490,"y":1400,"wires":[[]]},{"id":"4784b10d.8c1418","type":"api-call-service","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","name":"","server":"c6b350c5.b8b3c","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.relay_1_relay_3","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":2690,"y":1400,"wires":[[]]},{"id":"f87f1d9f.036a7","type":"stoptimer","z":"ae9b31fa.990e9","g":"f3d1d2cb.118008","duration":"2","units":"Hour","payloadtype":"num","payloadval":"0","name":"","x":2500,"y":1320,"wires":[["4784b10d.8c1418"],[]]},{"id":"c6b350c5.b8b3c","type":"server","name":"Home Assistant"}]