Light is not turn off when motion is not active


I have a very basic rule for testing with motion. I have Hubitat controlling the zwave devices. When the motion triggers, it instantly turns on the light but never turns it off. I have it set to turn off in 30 sec for testing purposes. My motion is Zooz 4 in 1 and set to time out after 15 sec. It works fine with turning off in 30sec on Hubitat. You can see it never reaches the turn off call service.

Also for more testing purposes. I configured the “turn on” call service to “turn off”. With the light on and motion is activated, it turns off right away.

I am using the latest version of Node Red. I don’t know what I am doing wrong?

That " For 30 Seconds" setting is to set a delay on the triggering.
It means the state have to stay On for 30 Seconds before triggering.

You should probably set the For Seconds value to 0 and then add a merge node from the trigger node.
The merge node act as a delay, where each new activation will reset the timer.
Once the timer is not reset and the it reaches 0, then the message is sent to the next node which should be the turn off service call node.

1 Like

Thank you for the suggestion. That worked until I wanted a 10 sec count down to let the person know the lights are going to turn off. My goal is after no motion for 15min, the light brightness drops to 15% brightness for 10 seconds before turning off. I’ll probably change it to 1 min to give the person a chance to wave their hand to reset 15min timer.

Here’s what’s working. I’m sure there is a better way.

What you are trying to do is break the flow by waving your hand and that is the big issue.
There probably is ways to do it, but I have not come up with a good solution myself.

Switch the event state around. Then use the transition key. This way it waits 30sec for the motion to be off and will take 10 sec to transition to off. If it retriggers calling "transition": 0 with the on command will override the previous transition to off.

[{"id":"86788b1044def783","type":"server-state-changed","z":"f80b6c338afd5483","name":"","server":"6b1110b5.183a4","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"motion sensor","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"30","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"date"}],"x":400,"y":4620,"wires":[["b75470d6eabf5cca"],["47b47840e8f32fdd"]]},{"id":"b75470d6eabf5cca","type":"api-call-service","z":"f80b6c338afd5483","name":"","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":[],"data":"{\"transition\":10}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":4580,"wires":[[]]},{"id":"47b47840e8f32fdd","type":"api-call-service","z":"f80b6c338afd5483","name":"","server":"6b1110b5.183a4","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":[],"data":"{\"transition\":0}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":4660,"wires":[[]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":false,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]
1 Like

Thank you. That worked. One of the main settings I had wrong when I was trying different settings is “If state is “On””. Which is supposed to be off.