Need help with Switch override for motion sensor for turning on lights

@Mikefila
So with the new iteration, the lights will turn on motion but will not turn off with switch override. :frowning:

[{"id":"e433ab36.c6b358","type":"api-call-service","z":"f80b6c338afd5483","name":"Mudroom Lights ON","server":"","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":1840,"y":3800,"wires":[[]]},{"id":"16bf9a80.ccead6","type":"api-call-service","z":"f80b6c338afd5483","name":"Mud Room Lights OFF","server":"","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","output_location":"","output_location_type":"none","x":1840,"y":3960,"wires":[[]]},{"id":"56668319.4c687c","type":"trigger-state","z":"f80b6c338afd5483","name":"Motion Sensor","server":"","version":2,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"}],"inputs":1,"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","enableInput":true,"x":990,"y":3800,"wires":[["f7c35a29892a7203"],["f7c35a29892a7203"]]},{"id":"279d7f80.57b5d","type":"change","z":"f80b6c338afd5483","name":"ENABLE","rules":[{"t":"set","p":"payload","pt":"msg","to":"enable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":725,"y":3900,"wires":[["56668319.4c687c"]],"icon":"font-awesome/fa-toggle-on","l":false},{"id":"a2d4c1a6.bb35a","type":"change","z":"f80b6c338afd5483","name":"DISABLE","rules":[{"t":"set","p":"payload","pt":"msg","to":"disable","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":835,"y":3800,"wires":[["56668319.4c687c"]],"icon":"font-awesome/fa-toggle-off","l":false},{"id":"0ffe09c3914bab93","type":"stoptimer","z":"f80b6c338afd5483","duration":"30","units":"Second","payloadtype":"num","payloadval":"0","name":"","x":1570,"y":3880,"wires":[["5660b85435a6eb11"],[]]},{"id":"5660b85435a6eb11","type":"api-current-state","z":"f80b6c338afd5483","name":"Motion Sensor Status","server":"","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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","x":1840,"y":3880,"wires":[["8fdd7877150f5c27"]]},{"id":"8fdd7877150f5c27","type":"switch","z":"f80b6c338afd5483","name":"Motion Detector Still ON? ","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1590,"y":3960,"wires":[["0ffe09c3914bab93"],["16bf9a80.ccead6"]]},{"id":"f7c35a29892a7203","type":"api-current-state","z":"f80b6c338afd5483","name":"","server":"","version":3,"outputs":2,"halt_if":"below_horizon","halt_if_type":"str","halt_if_compare":"is","entity_id":"sun.sun","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":1220,"y":3800,"wires":[["0ffe09c3914bab93","5a895141ced15188"],[]]},{"id":"3669b0496d8b225d","type":"server-state-changed","z":"f80b6c338afd5483","name":"Add to light.mud_room_lights to entity","server":"","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"device_tracker.pixel_3_2","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","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":330,"y":3900,"wires":[["f2fee74cacda5014"]]},{"id":"f2fee74cacda5014","type":"switch","z":"f80b6c338afd5483","name":"on/off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":3900,"wires":[["d30edbd5fda2de50"],["279d7f80.57b5d"]]},{"id":"d30edbd5fda2de50","type":"switch","z":"f80b6c338afd5483","name":"","property":"data.new_state.context.user_id","propertyType":"msg","rules":[{"t":"null"}],"checkall":"true","repair":false,"outputs":1,"x":710,"y":3800,"wires":[["a2d4c1a6.bb35a","fbcb3688cfd3569d"]]},{"id":"5a895141ced15188","type":"api-current-state","z":"f80b6c338afd5483","name":"Add to light.mud_room_lights to entity","server":"","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"","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":1550,"y":3800,"wires":[["e433ab36.c6b358"],[]]},{"id":"fbcb3688cfd3569d","type":"change","z":"f80b6c338afd5483","name":"stop timer if active","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1270,"y":3880,"wires":[["0ffe09c3914bab93"]]}]


I feel as though this is being way over engineered - why not create an input_boolean

Then create a flow to have motion control the light turning on/off with the input_boolean located right before the call_service node for the light to turn off

then create another flow to have the input_boolean turn on when the switch is hit

you can set the input_boolean to turn off when the light is turned off - resetting it if you will

Do you mind putting something up quickly and share the code… please.

I worked it a little bit differently to help simplify even more - the top output on the motion sensor node will turn on the light with motion - add what ever checks you want between the motion sensor and the light - time/sun/etc

The bottom will turn off the light if the switch is not hit as when it is called to turn on due to motion, it does not go to full brightness - just under - which you will not notice a difference.

When you hit the switch - it should change the brightness to max which would be outside of the switch node range therefore not passing the message.

You will have to turn the light off manually or through the UI if the on portion of the actual switch is hit.

[{"id":"fac0de9d0c8c4524","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"e1a1957d7a458bd0","type":"server-state-changed","z":"fac0de9d0c8c4524","name":"Motion sensor in entity","server":"c43f98a6.706d78","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"device_tracker.unifi_c2_8b_31_d2_34_af_13cmuaie","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,"for":"0","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":260,"y":660,"wires":[["8440f6d328b51e82","d135e3551918cd98"],["8440f6d328b51e82"]]},{"id":"9679d5776cd7facb","type":"api-call-service","z":"fac0de9d0c8c4524","name":"the light you want on","server":"c43f98a6.706d78","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.kitchen_island_pendants"],"data":"{\"brightness\" : \"240\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":920,"y":600,"wires":[[]]},{"id":"8440f6d328b51e82","type":"trigger","z":"fac0de9d0c8c4524","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"min","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":530,"y":740,"wires":[["eb5c14c99e6106aa"]]},{"id":"0c7f1186316cbb0f","type":"api-call-service","z":"fac0de9d0c8c4524","name":"light you want to turn off","server":"c43f98a6.706d78","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.kitchen_island_pendants"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1210,"y":740,"wires":[[]]},{"id":"0ed535751a14f5bb","type":"switch","z":"fac0de9d0c8c4524","name":"","property":"data.attributes.brightness","propertyType":"msg","rules":[{"t":"btwn","v":"1","vt":"num","v2":"242","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":950,"y":740,"wires":[["0c7f1186316cbb0f"]]},{"id":"eb5c14c99e6106aa","type":"api-current-state","z":"fac0de9d0c8c4524","name":"the light","server":"c43f98a6.706d78","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.kitchen_island_pendants","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":740,"y":740,"wires":[["0ed535751a14f5bb"]]},{"id":"d135e3551918cd98","type":"api-current-state","z":"fac0de9d0c8c4524","name":"the light","server":"c43f98a6.706d78","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"","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":520,"y":600,"wires":[["9679d5776cd7facb"],[]]},{"id":"c43f98a6.706d78","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"}]

@kagetaro99 thanks for putting this up for me.
That flow looks nice.
The lights do not turn off after X mins of no motion, I know the reason for this… let me explain a bit,
I have the Aqara motion sensor. The aqara ones work differently; they are more a ‘presence’ sensor as opposed to a ‘motion’ sensor. once triggered they stay ‘on’ for a minute, and if there is motion within that minute they stay on for another minute. So they only send an ‘off’ signal if they haven’t seen motion for a minute, which is the crucial difference. So you could be in the kitchen for 10 minutes and the aqara motion sensor never turns off, as there was ongoing motion in that time. But the timer never got restarted, as there wasn’t a new signal.

So to deal with that, you just need to check after the timer has been on for 10 minutes if the motion sensor is still on. If so, restart the timer. If not, turn off the light.
This is the bit that needs to be added to make the Aqara motion sensors work.

But I just do not know how to add these to your flow and make it work. Can u pls look into this?

The flow I sent will register the off signal sent by the sensor - you can adjust the time of the trigger node to what ever you like. That will be the time it would take for there to be no motion and the light go off.

I guess I’m confused as to what you end goal is.

You want the light turned on by motion and off after a certain period of no motion - with a way to override and the light not turn off correct?

Thats right.
However right now with ur latest script, the lights wont even turn off when no motion is detected.

Send me what you have and let me take a look - it works on my side

sure…

[{"id":"d3e308906cfd89e5","type":"server-state-changed","z":"a22e97f7141e86f5","name":"Motion sensor","server":"2736f9e1.3a6d56","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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,"for":"0","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":110,"y":140,"wires":[["4f09a0c090230c07","3ff4e7eb0ab7d1e2"],["4f09a0c090230c07"]]},{"id":"594880d660a326d3","type":"api-call-service","z":"a22e97f7141e86f5","name":"Lights - ON","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["garage"],"deviceId":["4f9bfa253ff105c8bd4470e83c911c17"],"entityId":[],"data":"{brightness: 240}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":80,"wires":[[]]},{"id":"4f09a0c090230c07","type":"trigger","z":"a22e97f7141e86f5","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":410,"y":220,"wires":[["6ce44e252109895e"]]},{"id":"93e836699e4c432b","type":"api-call-service","z":"a22e97f7141e86f5","name":"light you want to turn off","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1090,"y":220,"wires":[[]]},{"id":"4e71d4bedc9433df","type":"switch","z":"a22e97f7141e86f5","name":"","property":"data.new_state.attributes.brightness","propertyType":"msg","rules":[{"t":"btwn","v":"1","vt":"num","v2":"242","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":830,"y":220,"wires":[["93e836699e4c432b"]]},{"id":"6ce44e252109895e","type":"api-current-state","z":"a22e97f7141e86f5","name":"the light","server":"2736f9e1.3a6d56","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":620,"y":220,"wires":[["4e71d4bedc9433df"]]},{"id":"3ff4e7eb0ab7d1e2","type":"api-current-state","z":"a22e97f7141e86f5","name":"Light","server":"2736f9e1.3a6d56","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":390,"y":80,"wires":[["594880d660a326d3"],[]]},{"id":"2736f9e1.3a6d56","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"}]

Change the node where it turns on the light -

You have something in the device portion - make the entity - light.mud_room_lights

Also for the data section make it {“brightness” : “240”}

Made the change, made no difference at all.

[{"id":"d3e308906cfd89e5","type":"server-state-changed","z":"a22e97f7141e86f5","name":"Motion sensor","server":"2736f9e1.3a6d56","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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,"for":"0","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":110,"y":140,"wires":[["4f09a0c090230c07","3ff4e7eb0ab7d1e2"],["4f09a0c090230c07"]]},{"id":"594880d660a326d3","type":"api-call-service","z":"a22e97f7141e86f5","name":"Lights - ON","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"{brightness: 240}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":770,"y":80,"wires":[[]]},{"id":"4f09a0c090230c07","type":"trigger","z":"a22e97f7141e86f5","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":410,"y":220,"wires":[["6ce44e252109895e"]]},{"id":"93e836699e4c432b","type":"api-call-service","z":"a22e97f7141e86f5","name":"light you want to turn off","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1090,"y":220,"wires":[[]]},{"id":"4e71d4bedc9433df","type":"switch","z":"a22e97f7141e86f5","name":"","property":"data.new_state.attributes.brightness","propertyType":"msg","rules":[{"t":"btwn","v":"1","vt":"num","v2":"242","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":830,"y":220,"wires":[["93e836699e4c432b"]]},{"id":"6ce44e252109895e","type":"api-current-state","z":"a22e97f7141e86f5","name":"the light","server":"2736f9e1.3a6d56","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":620,"y":220,"wires":[["4e71d4bedc9433df"]]},{"id":"3ff4e7eb0ab7d1e2","type":"api-current-state","z":"a22e97f7141e86f5","name":"Light","server":"2736f9e1.3a6d56","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":390,"y":80,"wires":[["594880d660a326d3"],[]]},{"id":"2736f9e1.3a6d56","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"}]

Lets start here - Will this turn the light on and off with motion?

You said after 1 min of no motion it will send an off signal which should turn the light off

[{"id":"47a48750ed1147d1","type":"server-state-changed","z":"fac0de9d0c8c4524","name":"Motion sensor","server":"2736f9e1.3a6d56","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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,"for":"0","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":790,"y":260,"wires":[["96a453e9e3690635"],["ecc60bec265f2cd5"]]},{"id":"96a453e9e3690635","type":"api-call-service","z":"fac0de9d0c8c4524","name":"Lights - ON","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["garage"],"deviceId":["4f9bfa253ff105c8bd4470e83c911c17"],"entityId":[],"data":"{\"brightness\" : \"240\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1070,"y":220,"wires":[[]]},{"id":"ecc60bec265f2cd5","type":"api-call-service","z":"fac0de9d0c8c4524","name":"light you want to turn off","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1070,"y":320,"wires":[[]]},{"id":"2736f9e1.3a6d56","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"}]

Also - I just imported your last flow and your data section is wrong

it needs to be

{“brightness” : “240”}

success, lights turn on with motion and turn off after one min.

[{"id":"3c74786fcf7dd8fc","type":"server-state-changed","z":"a22e97f7141e86f5","name":"Motion sensor","server":"2736f9e1.3a6d56","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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,"for":"0","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":120,"wires":[["015eb9a0d7731924"],["41a72c1cd35a9d22"]]},{"id":"015eb9a0d7731924","type":"api-call-service","z":"a22e97f7141e86f5","name":"Lights - ON","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["garage"],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"{\"brightness\" : \"240\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":430,"y":80,"wires":[[]]},{"id":"41a72c1cd35a9d22","type":"api-call-service","z":"a22e97f7141e86f5","name":"light you want to turn off","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":430,"y":180,"wires":[[]]},{"id":"2736f9e1.3a6d56","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 data is set to the value you mentioned. pls see below.

What am i doing wrong?

Now add the other nodes into that flow where they were before and let me know what happens

I think I found the issue

[{"id":"2071babfcaf83090","type":"server-state-changed","z":"77c3489f49a085d8","name":"Motion sensor","server":"2736f9e1.3a6d56","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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,"for":"0","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":310,"y":1360,"wires":[["bbedf0c0ff393790"],["b147805e4931febc"]]},{"id":"2e31dab527102d79","type":"api-call-service","z":"77c3489f49a085d8","name":"Lights - ON","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["garage"],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"{\"brightness\" : \"240\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":830,"y":1320,"wires":[[]]},{"id":"d6474f94eceb8341","type":"api-call-service","z":"77c3489f49a085d8","name":"light you want to turn off","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1150,"y":1420,"wires":[[]]},{"id":"bbedf0c0ff393790","type":"api-current-state","z":"77c3489f49a085d8","name":"Light","server":"2736f9e1.3a6d56","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":550,"y":1320,"wires":[["2e31dab527102d79"],[]]},{"id":"b147805e4931febc","type":"trigger","z":"77c3489f49a085d8","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":510,"y":1440,"wires":[["8b21f3da44bfab5d"]]},{"id":"ada0311d4ca02a03","type":"switch","z":"77c3489f49a085d8","name":"","property":"data.attributes.brightness","propertyType":"msg","rules":[{"t":"btwn","v":"1","vt":"num","v2":"242","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":930,"y":1440,"wires":[["d6474f94eceb8341"]]},{"id":"8b21f3da44bfab5d","type":"api-current-state","z":"77c3489f49a085d8","name":"the light","server":"2736f9e1.3a6d56","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":760,"y":1440,"wires":[["ada0311d4ca02a03"]]},{"id":"2736f9e1.3a6d56","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"}]

try this and let me know

ok trying now.

I am sorry, no luck.
Lights turn on with motion.
But turning on the switch / switch override will not work… light turns off after x time

[{"id":"2071babfcaf83090","type":"server-state-changed","z":"77c3489f49a085d8","name":"Motion sensor","server":"2736f9e1.3a6d56","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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,"for":"0","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":310,"y":1360,"wires":[["bbedf0c0ff393790"],["b147805e4931febc"]]},{"id":"2e31dab527102d79","type":"api-call-service","z":"77c3489f49a085d8","name":"Lights - ON","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["garage"],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"{\"brightness\" : \"240\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":830,"y":1320,"wires":[[]]},{"id":"d6474f94eceb8341","type":"api-call-service","z":"77c3489f49a085d8","name":"light you want to turn off","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1150,"y":1420,"wires":[[]]},{"id":"bbedf0c0ff393790","type":"api-current-state","z":"77c3489f49a085d8","name":"Light","server":"2736f9e1.3a6d56","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":550,"y":1320,"wires":[["2e31dab527102d79"],[]]},{"id":"b147805e4931febc","type":"trigger","z":"77c3489f49a085d8","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":510,"y":1440,"wires":[["8b21f3da44bfab5d"]]},{"id":"ada0311d4ca02a03","type":"switch","z":"77c3489f49a085d8","name":"","property":"data.attributes.brightness","propertyType":"msg","rules":[{"t":"btwn","v":"1","vt":"num","v2":"242","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":930,"y":1440,"wires":[["d6474f94eceb8341"]]},{"id":"8b21f3da44bfab5d","type":"api-current-state","z":"77c3489f49a085d8","name":"the light","server":"2736f9e1.3a6d56","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":760,"y":1440,"wires":[["ada0311d4ca02a03"]]},{"id":"2736f9e1.3a6d56","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"}]

Is it ok if u pm you directly?

I sent you one and let you know that flow is missing the connection from output 1 of the motion sensor to the trigger node

[{"id":"9fbbabfb81fff06c","type":"server-state-changed","z":"611bc29c658e8df7","name":"Motion sensor","server":"2736f9e1.3a6d56","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.lumi_lumi_sensor_motion_aq2_d930f806_ias_zone","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,"for":"0","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":450,"y":300,"wires":[["d70f1096ee45a0eb","c6d3af9dabfc99ca"],["c6d3af9dabfc99ca"]]},{"id":"297ae742be5bc0a7","type":"api-call-service","z":"611bc29c658e8df7","name":"Lights - ON","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":["garage"],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"{\"brightness\" : \"240\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":970,"y":260,"wires":[[]]},{"id":"90ab0b2d7b7be4b6","type":"api-call-service","z":"611bc29c658e8df7","name":"light you want to turn off","server":"2736f9e1.3a6d56","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":[],"entityId":["light.mud_room_lights"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1310,"y":380,"wires":[[]]},{"id":"d70f1096ee45a0eb","type":"api-current-state","z":"611bc29c658e8df7","name":"Light","server":"2736f9e1.3a6d56","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":690,"y":260,"wires":[["297ae742be5bc0a7"],[]]},{"id":"c6d3af9dabfc99ca","type":"trigger","z":"611bc29c658e8df7","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":650,"y":380,"wires":[["8a576d6e61ddab52"]]},{"id":"f6110f5e2e30051a","type":"switch","z":"611bc29c658e8df7","name":"","property":"data.attributes.brightness","propertyType":"msg","rules":[{"t":"btwn","v":"1","vt":"num","v2":"242","v2t":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":380,"wires":[["90ab0b2d7b7be4b6"]]},{"id":"8a576d6e61ddab52","type":"api-current-state","z":"611bc29c658e8df7","name":"the light","server":"2736f9e1.3a6d56","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"light.mud_room_lights","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":900,"y":380,"wires":[["f6110f5e2e30051a"]]},{"id":"2736f9e1.3a6d56","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"}]