@Bestofbasile
Here is my flow with some more adjustments.
I did the power with a trigger node finally.
A power > X Watts that stops the timer after the scene is started.
A power > X Watts that stops the timer each time if a new motion is triggert.
And A power < Watts to start the timer again
With these combinations you cover up all situations
I also made a adjustment on the state machine node because my z-wave switch was sending states that made the state machine stuck on a state without the possibility to trigger a motion again.
I want to make a extra setting so double clic on the switch will override the timer but that is for later.
And I made a check lux in the scene that when the lights are on and lux goes above a value the lights go out.
At this moment the scene is working like I have with Fibaro LUA code for the past 6 years so I’m happy so far.
If All things keep on working well I think I go to post my “Smart lights” node red flow official because I did not see the solution like I did yet in this forum.
I have also a flow with 2 motion sensors and more lights to check.
[{"id":"5eae6502a99b6b76","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"6d282604d7443090","type":"trigger-state","z":"5eae6502a99b6b76","name":"Zolder motion","server":"85cb4144.a30f7","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.zolder_kamer_zolderkamer_motion_309","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"outputs":2,"customoutputs":[],"outputinitially":false,"x":80,"y":80,"wires":[["53f089b290242e3b"],[]]},{"id":"47f05cf8d6864adb","type":"trigger-state","z":"5eae6502a99b6b76","name":"Zolder lights","server":"85cb4144.a30f7","version":0,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"light.zolder_kamer_zolder_light_695","entityidfiltertype":"regex","debugenabled":false,"constraints":[],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":70,"y":420,"wires":[["3a0131da65518731"],[]]},{"id":"504bd3934e42151f","type":"api-call-service","z":"5eae6502a99b6b76","name":"Light On 30%","server":"85cb4144.a30f7","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.zolder_kamer_zolder_light_695","data":"{\"brightness_pct\":30}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":140,"wires":[["adf7426d85e4a457"]]},{"id":"332a886aef22abc4","type":"api-call-service","z":"5eae6502a99b6b76","name":"Turn off lights","server":"85cb4144.a30f7","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.zolder_kamer_zolder_light_695","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":380,"wires":[["aeb28ec9c40fc262"]]},{"id":"3a0131da65518731","type":"change","z":"5eae6502a99b6b76","name":"switch","rules":[{"t":"set","p":"payload","pt":"msg","to":"switch","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":230,"y":420,"wires":[["cf8d010be097dcd5"]]},{"id":"876c4bae42b90bb9","type":"change","z":"5eae6502a99b6b76","name":"motion","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":120,"wires":[["cf8d010be097dcd5"]]},{"id":"414dedce40403034","type":"stoptimer","z":"5eae6502a99b6b76","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"pause detection","x":1040,"y":500,"wires":[["73198c89ebe706ef"],[]]},{"id":"73198c89ebe706ef","type":"api-current-state","z":"5eae6502a99b6b76","name":"Light state","server":"85cb4144.a30f7","version":2,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.zolder_kamer_zolder_light_695","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":1290,"y":380,"wires":[["5e6a0c287697f584"]]},{"id":"2f81a68f363a9f86","type":"change","z":"5eae6502a99b6b76","name":"stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":660,"wires":[["08eec4c38361ac8a"]]},{"id":"84188ca05f1ea590","type":"change","z":"5eae6502a99b6b76","name":"motion-on","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion-on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":280,"wires":[["5e6a0c287697f584"]]},{"id":"c0739b11882578fb","type":"change","z":"5eae6502a99b6b76","name":"motion-off","rules":[{"t":"set","p":"payload","pt":"msg","to":"motion-off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1280,"y":440,"wires":[["5e6a0c287697f584"]]},{"id":"aeb28ec9c40fc262","type":"stoptimer","z":"5eae6502a99b6b76","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"pause","x":1010,"y":380,"wires":[["73198c89ebe706ef"],[]]},{"id":"adf7426d85e4a457","type":"stoptimer","z":"5eae6502a99b6b76","duration":"10","units":"Second","payloadtype":"num","payloadval":"0","name":"pause","x":1270,"y":220,"wires":[["84188ca05f1ea590"],[]]},{"id":"114a9cd674bdcd85","type":"switch","z":"5eae6502a99b6b76","name":"motion-detected","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-detected","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":640,"y":360,"wires":[["126bc55c7d61eb77","e5a7032f1892e1f7","7968e0677dc39310","f2db36b13dc6a527"]]},{"id":"2783b29ac034d83a","type":"switch","z":"5eae6502a99b6b76","name":"motion-on","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-on","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":620,"y":440,"wires":[["08eec4c38361ac8a","c6ede231124b5e57"]]},{"id":"90e1ef0a10fb5564","type":"link in","z":"5eae6502a99b6b76","name":"kitchen state machine","links":["5e6a0c287697f584"],"x":215,"y":480,"wires":[["cf8d010be097dcd5"]]},{"id":"5e6a0c287697f584","type":"link out","z":"5eae6502a99b6b76","name":"kitchen state machine","links":["90e1ef0a10fb5564"],"x":1435,"y":320,"wires":[]},{"id":"4aa4356740464a48","type":"switch","z":"5eae6502a99b6b76","name":"switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"switch","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":610,"y":480,"wires":[["2f81a68f363a9f86","414dedce40403034"]]},{"id":"d13a23694fd79305","type":"switch","z":"5eae6502a99b6b76","name":"motion-off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"motion-off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":620,"y":400,"wires":[["332a886aef22abc4"]]},{"id":"08eec4c38361ac8a","type":"stoptimer","z":"5eae6502a99b6b76","duration":"5","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":1040,"y":440,"wires":[["c0739b11882578fb"],[]]},{"id":"53f089b290242e3b","type":"api-current-state","z":"5eae6502a99b6b76","name":"Zolder Lux < 30","server":"85cb4144.a30f7","version":2,"outputs":1,"halt_if":"","halt_if_type":"num","halt_if_compare":"is","entity_id":"sensor.zolder_kamer_zolder_lux_311","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"x":280,"y":80,"wires":[["222c4b9da609a862","5dd9a4eedcaf8014"]]},{"id":"126bc55c7d61eb77","type":"api-current-state","z":"5eae6502a99b6b76","name":"Morning","server":"85cb4144.a30f7","version":2,"outputs":2,"halt_if":"Morning","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":820,"y":140,"wires":[["504bd3934e42151f"],[]]},{"id":"e5a7032f1892e1f7","type":"api-current-state","z":"5eae6502a99b6b76","name":"Day","server":"85cb4144.a30f7","version":2,"outputs":2,"halt_if":"Day","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":810,"y":200,"wires":[["95b963b027970ece"],[]]},{"id":"7968e0677dc39310","type":"api-current-state","z":"5eae6502a99b6b76","name":"Evening","server":"85cb4144.a30f7","version":2,"outputs":2,"halt_if":"Evening","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":820,"y":260,"wires":[["82bd50f100bf9e81"],[]]},{"id":"f2db36b13dc6a527","type":"api-current-state","z":"5eae6502a99b6b76","name":"Night","server":"85cb4144.a30f7","version":2,"outputs":2,"halt_if":"Night","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.time_of_day","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":810,"y":320,"wires":[["eac31afb8bcd92cd"],[]]},{"id":"95b963b027970ece","type":"api-call-service","z":"5eae6502a99b6b76","name":"Light On 20%","server":"85cb4144.a30f7","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.zolder_kamer_zolder_light_695","data":"{\"brightness_pct\":20}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":200,"wires":[["adf7426d85e4a457"]]},{"id":"82bd50f100bf9e81","type":"api-call-service","z":"5eae6502a99b6b76","name":"Light On 10%","server":"85cb4144.a30f7","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.zolder_kamer_zolder_light_695","data":"{\"brightness_pct\":10}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1040,"y":260,"wires":[["adf7426d85e4a457"]]},{"id":"eac31afb8bcd92cd","type":"api-call-service","z":"5eae6502a99b6b76","name":"Light On 5%","server":"85cb4144.a30f7","version":3,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.zolder_kamer_zolder_light_695","data":"{\"brightness_pct\":5}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1030,"y":320,"wires":[["adf7426d85e4a457"]]},{"id":"402b97daec21fb39","type":"comment","z":"5eae6502a99b6b76","name":"Smart Lights Zolder","info":"","x":90,"y":40,"wires":[]},{"id":"4375aac36897a116","type":"server-state-changed","z":"5eae6502a99b6b76","name":"power state > 110","server":"85cb4144.a30f7","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.computer_sensor_current","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"110","halt_if_type":"num","halt_if_compare":"gt","outputs":2,"output_only_on_state_change":true,"for":"80","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"true","valueType":"bool"}],"x":430,"y":660,"wires":[["3cb282755d12f06b"],[]]},{"id":"3cb282755d12f06b","type":"trigger","z":"5eae6502a99b6b76","name":"> 110W","op1":"true","op2":"0","op1type":"bool","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"false","bytopic":"all","topic":"topic","outputs":1,"x":620,"y":660,"wires":[["2f81a68f363a9f86"]]},{"id":"67d4cb452fdef5d4","type":"change","z":"5eae6502a99b6b76","name":"start","rules":[{"t":"set","p":"payload","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":600,"wires":[["08eec4c38361ac8a"]]},{"id":"598f1c16efa26a8f","type":"server-state-changed","z":"5eae6502a99b6b76","name":"power state < 90","server":"85cb4144.a30f7","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.computer_sensor_current","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"90","halt_if_type":"num","halt_if_compare":"lt","outputs":2,"output_only_on_state_change":true,"for":"40","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"true","valueType":"bool"}],"x":420,"y":600,"wires":[["5afb07bd4282fff8"],[]]},{"id":"5afb07bd4282fff8","type":"trigger","z":"5eae6502a99b6b76","name":"< 90W","op1":"true","op2":"0","op1type":"bool","op2type":"str","duration":"0","extend":false,"overrideDelay":false,"units":"ms","reset":"false","bytopic":"all","topic":"topic","outputs":1,"x":610,"y":600,"wires":[["67d4cb452fdef5d4"]]},{"id":"fbe36a4f1a8be687","type":"rbe","z":"5eae6502a99b6b76","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":610,"y":80,"wires":[["332a886aef22abc4"]]},{"id":"198666c91683ecac","type":"api-call-service","z":"5eae6502a99b6b76","name":"Light Off > 35 Lux","server":"85cb4144.a30f7","version":3,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.zolder_kamer_zolder_light_695","data":"","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":850,"y":80,"wires":[[]]},{"id":"222c4b9da609a862","type":"switch","z":"5eae6502a99b6b76","name":"> 35","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"35","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":450,"y":80,"wires":[["fbe36a4f1a8be687"]]},{"id":"5dd9a4eedcaf8014","type":"switch","z":"5eae6502a99b6b76","name":"< 35","property":"payload","propertyType":"msg","rules":[{"t":"lt","v":"35","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":450,"y":120,"wires":[["876c4bae42b90bb9"]]},{"id":"2f8540ea98b64479","type":"rbe","z":"5eae6502a99b6b76","name":"","func":"rbe","gap":"","start":"","inout":"out","septopics":false,"property":"payload","topi":"topic","x":130,"y":160,"wires":[[]]},{"id":"cf8d010be097dcd5","type":"state-machine","z":"5eae6502a99b6b76","name":"","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"","persistOnReload":false,"outputStateChangeOnly":true,"throwException":false,"states":["switch","motion-detected","motion-on","motion-off","off","on","motion"],"transitions":[{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"motion-on","to":"motion-on"},{"name":"on","from":"*","to":"on"},{"name":"switch","from":"off","to":"switch"},{"name":"switch","from":"on","to":"switch"},{"name":"switch","from":"switch","to":"switch"},{"name":"switch","from":"motion-on","to":"switch"},{"name":"motion-on","from":"motion-detected","to":"motion-on"},{"name":"motion-off","from":"motion-on","to":"motion-off"},{"name":"motion","from":"switch","to":"motion-detected"},{"name":"motion","from":"off","to":"motion-detected"},{"name":"motion","from":"on","to":"motion-detected"},{"name":"motion","from":"motion-off","to":"motion-detected"}],"x":420,"y":420,"wires":[["114a9cd674bdcd85","d13a23694fd79305","2783b29ac034d83a","4aa4356740464a48"]]},{"id":"6a1269865c604e0b","type":"api-current-state","z":"5eae6502a99b6b76","name":"Power > 85","server":"85cb4144.a30f7","version":2,"outputs":2,"halt_if":"110","halt_if_type":"num","halt_if_compare":"gt","entity_id":"sensor.computer_sensor_current","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":830,"y":540,"wires":[["2f81a68f363a9f86"],[]]},{"id":"c6ede231124b5e57","type":"stoptimer","z":"5eae6502a99b6b76","duration":"1","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":640,"y":540,"wires":[["6a1269865c604e0b"],[]]},{"id":"85cb4144.a30f7","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]