Trying to action active lights in a group

Hello,
I am working on a node red flow to automate my office lighting. The office has three lights, a hue remote and a hue sensor (occupancy and luminance) all on ZHA. If I am working in the office I will press the Hue remote and choose the office on or office workbench scenes. If I walk into the office, the occupancy sensor will trigger a flow that sets the office walk-in scene. I use a helper to record when a scene is set, and if the sensor triggers occupancy off, I check if the last scene to be set is still walk-in. This prevents the sensor from affecting the lighting once I have used the remote to set a scene.

The RWL022 Hue Remote has a Power button, Hue Button, Dim Up and Dim Down. Pressing the power button, checks the office lights helper group - if it reports on (any lights are on), then all lights are turned off. If no lights are on then the default office on scene is set.

Scenes:
“on” sets office ceiling on and office standard on and office workbench off
“workbench” sets office ceiling on, office standard on and office workbench on
“off” sets office ceiling off, office standard off and office workbench off
“walk-in” sets office ceiling on and office standard off and office workbench off

All of this is handled in the flow:

[{"id":"2d4b6952ae30efd7","type":"junction","z":"12b919271b59722d","x":660,"y":980,"wires":[["29cc36fd30c1454e"]]},{"id":"2cd1af3c65280cfc","type":"junction","z":"12b919271b59722d","x":1200,"y":940,"wires":[["2d4b6952ae30efd7"]]},{"id":"285932bdcd0d539f","type":"group","z":"12b919271b59722d","name":"Set scene and record in helper","style":{"label":true},"nodes":["3e067b4e5ec473dc","50730bc97a9cbbbf","3e88424df73c43d8","c5ab7f99446aac33"],"x":1584,"y":879,"w":642,"h":142},{"id":"3e067b4e5ec473dc","type":"api-call-service","z":"12b919271b59722d","g":"285932bdcd0d539f","name":"Set scene","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"scene","service":"turn_on","areaId":[],"deviceId":[],"entityId":["{{payload.entity_id}}"],"data":"{ \"transition\": \"2\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1740,"y":920,"wires":[["3e88424df73c43d8"]]},{"id":"50730bc97a9cbbbf","type":"debug","z":"12b919271b59722d","g":"285932bdcd0d539f","name":"debug 93","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":2120,"y":980,"wires":[]},{"id":"3e88424df73c43d8","type":"api-call-service","z":"12b919271b59722d","g":"285932bdcd0d539f","name":"Record Scene","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.steve_s_office_last_scene"],"data":"{ \"value\": \"{{payload.entity_id}}\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1900,"y":980,"wires":[["50730bc97a9cbbbf"]]},{"id":"c5ab7f99446aac33","type":"link in","z":"12b919271b59722d","g":"285932bdcd0d539f","name":"link in 1","links":["36cb83176733b286","800f28db3807b8ee","37f9590522b57ddf","a1a23937fc36132b","62b66a33eb45bf02","5c997db9408fbc41"],"x":1625,"y":920,"wires":[["3e067b4e5ec473dc"]]},{"id":"2be748d3.da7088","type":"server","name":"Home Assistant","addon":true},{"id":"debac9e370303f3d","type":"group","z":"12b919271b59722d","name":"Handle Dim Up or Down","style":{"label":true},"nodes":["d9a180c3eb3e9066","5a99e98bd8a48de7","fee7641eed0e5109","ce352a4e66ee7f53","2d8513f59c36c960","125329decf63b43c"],"x":794,"y":579,"w":672,"h":182},{"id":"d9a180c3eb3e9066","type":"switch","z":"12b919271b59722d","g":"debac9e370303f3d","name":"Dim up or down","property":"payload.event.params.step_mode","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":900,"y":680,"wires":[["fee7641eed0e5109","125329decf63b43c"],["5a99e98bd8a48de7","125329decf63b43c"]],"outputLabels":["dim down","dim up"]},{"id":"5a99e98bd8a48de7","type":"api-call-service","z":"12b919271b59722d","g":"debac9e370303f3d","name":"Dim Down","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.steves_office"],"data":"{ \"brightness_step\" : -30 , \"transition\" : 1}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1170,"y":720,"wires":[["ce352a4e66ee7f53"]]},{"id":"fee7641eed0e5109","type":"api-call-service","z":"12b919271b59722d","g":"debac9e370303f3d","name":"Dim Up","server":"2be748d3.da7088","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.steves_office"],"data":"{ \"brightness_step\" : 30 , \"transition\" : 1}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1160,"y":660,"wires":[["2d8513f59c36c960"]]},{"id":"ce352a4e66ee7f53","type":"debug","z":"12b919271b59722d","g":"debac9e370303f3d","name":"debug 102","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1350,"y":720,"wires":[]},{"id":"2d8513f59c36c960","type":"debug","z":"12b919271b59722d","g":"debac9e370303f3d","name":"debug 103","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1330,"y":660,"wires":[]},{"id":"125329decf63b43c","type":"debug","z":"12b919271b59722d","g":"debac9e370303f3d","name":"debug 104","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.event.params.step_size","targetType":"msg","statusVal":"","statusType":"auto","x":1170,"y":620,"wires":[]},{"id":"7b492839f19258d0","type":"group","z":"12b919271b59722d","name":"Hendle Press Hue","style":{"label":true},"nodes":["bfe7514e5ca57d31","a1a23937fc36132b"],"x":794,"y":459,"w":672,"h":82},{"id":"bfe7514e5ca57d31","type":"change","z":"12b919271b59722d","g":"7b492839f19258d0","name":"scene=workbench","rules":[{"t":"set","p":"payload.scene","pt":"msg","to":"Steve's Office Workbench","tot":"str"},{"t":"set","p":"payload.entity_id","pt":"msg","to":"scene.steve_s_office_workbench","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":500,"wires":[["a1a23937fc36132b"]]},{"id":"a1a23937fc36132b","type":"link out","z":"12b919271b59722d","g":"7b492839f19258d0","name":"link out 4","mode":"link","links":["c5ab7f99446aac33"],"x":1425,"y":500,"wires":[]},{"id":"bedc81309100169a","type":"group","z":"12b919271b59722d","name":"Handle Double Press Power","style":{"label":true},"nodes":["4e9d4b116966a0da","62b66a33eb45bf02"],"x":794,"y":339,"w":672,"h":82},{"id":"4e9d4b116966a0da","type":"change","z":"12b919271b59722d","g":"bedc81309100169a","name":"scene=on","rules":[{"t":"set","p":"payload.scene","pt":"msg","to":"Steve's Office On","tot":"str"},{"t":"set","p":"payload.entity_id","pt":"msg","to":"scene.steve_s_office_on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":380,"wires":[["62b66a33eb45bf02"]]},{"id":"62b66a33eb45bf02","type":"link out","z":"12b919271b59722d","g":"bedc81309100169a","name":"link out 5","mode":"link","links":["c5ab7f99446aac33"],"x":1425,"y":380,"wires":[]},{"id":"f8a10db8e81dc60e","type":"group","z":"12b919271b59722d","name":"Handle Press Power","style":{"label":true},"nodes":["e3eff4e31cac3a5f","9ca829b1be4953af","d55fbbf893291aa6","b3d193a2a6200730","64114f375709e948","263883bb8c046dc3","800f28db3807b8ee","37f9590522b57ddf","5576db1aa6c126c4"],"x":794,"y":99,"w":672,"h":202},{"id":"e3eff4e31cac3a5f","type":"switch","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"Lights group on?","property":"payload[0].state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1130,"y":220,"wires":[["d55fbbf893291aa6","64114f375709e948"],["9ca829b1be4953af","263883bb8c046dc3"]]},{"id":"9ca829b1be4953af","type":"debug","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"debug 96","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","statusVal":"","statusType":"auto","x":1320,"y":260,"wires":[]},{"id":"d55fbbf893291aa6","type":"debug","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"debug 97","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","statusVal":"","statusType":"auto","x":1320,"y":140,"wires":[]},{"id":"b3d193a2a6200730","type":"ha-get-entities","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"Get light group status","server":"2be748d3.da7088","version":0,"rules":[{"property":"entity_id","logic":"is","value":"light.steves_office","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":920,"y":220,"wires":[["e3eff4e31cac3a5f"]]},{"id":"64114f375709e948","type":"change","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"scene=off","rules":[{"t":"set","p":"payload.scene","pt":"msg","to":"Steve's Office Off","tot":"str"},{"t":"set","p":"payload.entity_id","pt":"msg","to":"scene.steve_s_office_off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1320,"y":180,"wires":[["37f9590522b57ddf"]]},{"id":"263883bb8c046dc3","type":"change","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"scene=on","rules":[{"t":"set","p":"payload.scene","pt":"msg","to":"Steve's Office On","tot":"str"},{"t":"set","p":"payload.entity_id","pt":"msg","to":"scene.steve_s_office_on","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1320,"y":220,"wires":[["800f28db3807b8ee"]]},{"id":"800f28db3807b8ee","type":"link out","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"link out 2","mode":"link","links":["c5ab7f99446aac33"],"x":1425,"y":220,"wires":[]},{"id":"37f9590522b57ddf","type":"link out","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"link out 3","mode":"link","links":["c5ab7f99446aac33"],"x":1425,"y":180,"wires":[]},{"id":"5576db1aa6c126c4","type":"comment","z":"12b919271b59722d","g":"f8a10db8e81dc60e","name":"Determine if \\n Turn on or off","info":"","x":890,"y":160,"wires":[]},{"id":"a72a22ec6f1e6af6","type":"group","z":"12b919271b59722d","name":"Trigger on remote ","style":{"label":true},"nodes":["a5ac185d5af469f1","506fa7e6a785c708","cdcfbb828497a9e7","953eaf85dcaedfb5","57bbc8230885597d","f532464e3542d819","71be7d835a426d01","b4bed48b90f25c60"],"x":74,"y":59,"w":492,"h":407},{"id":"a5ac185d5af469f1","type":"server-events","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"Hue Test remote RWL022","server":"2be748d3.da7088","version":2,"eventType":"","exposeToHomeAssistant":false,"eventData":"{\"device_ieee\":\"00:17:88:01:0b:59:ef:1a\"}","haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"event_type":"","x":210,"y":100,"wires":[["f532464e3542d819","506fa7e6a785c708"]]},{"id":"506fa7e6a785c708","type":"switch","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"","property":"payload.event.command","propertyType":"msg","rules":[{"t":"eq","v":"on_press","vt":"str"},{"t":"eq","v":"on_double_press","vt":"str"},{"t":"eq","v":"off_press","vt":"str"},{"t":"eq","v":"off_double_press","vt":"str"},{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"on_short_release","vt":"str"},{"t":"eq","v":"off_with_effect","vt":"str"},{"t":"eq","v":"on_triple_press","vt":"str"},{"t":"eq","v":"recall","vt":"str"},{"t":"eq","v":"off_triple_press","vt":"str"},{"t":"eq","v":"up_press","vt":"str"},{"t":"eq","v":"up_short_release","vt":"str"},{"t":"eq","v":"step","vt":"str"},{"t":"eq","v":"up_long_release","vt":"str"},{"t":"eq","v":"stop","vt":"str"},{"t":"eq","v":"up_hold","vt":"str"}],"checkall":"true","repair":false,"outputs":16,"x":470,"y":320,"wires":[["b3d193a2a6200730"],["4e9d4b116966a0da"],["bfe7514e5ca57d31"],[],[],[],[],[],[],[],[],[],["d9a180c3eb3e9066"],[],[],[]],"outputLabels":["Press Power","Dbl press Power","Press hue","","","","","","","","","","","","",""]},{"id":"cdcfbb828497a9e7","type":"inject","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"Pwr Press","props":[{"p":"payload.event.command","v":"on_press","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":200,"wires":[["506fa7e6a785c708"]]},{"id":"953eaf85dcaedfb5","type":"inject","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"Hue Press","props":[{"p":"payload.event.command","v":"off_press","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":180,"y":280,"wires":[["506fa7e6a785c708"]]},{"id":"57bbc8230885597d","type":"inject","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"Pwr Dbl Press","props":[{"p":"payload.event.command","v":"on_double_press","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":190,"y":240,"wires":[["506fa7e6a785c708"]]},{"id":"f532464e3542d819","type":"debug","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"debug 78","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":100,"wires":[]},{"id":"71be7d835a426d01","type":"inject","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"Dim Up Press","props":[{"p":"payload.event.command","v":"step","vt":"str"},{"p":"payload.event.params.step_mode","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":190,"y":320,"wires":[["506fa7e6a785c708"]]},{"id":"b4bed48b90f25c60","type":"inject","z":"12b919271b59722d","g":"a72a22ec6f1e6af6","name":"Dim Down Press","props":[{"p":"payload.event.command","v":"step","vt":"str"},{"p":"payload.event.params.step_mode","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":360,"wires":[["506fa7e6a785c708"]]},{"id":"aee6dc901396d8ee","type":"group","z":"12b919271b59722d","name":"Trigger on Occupancy Sensor","style":{"label":true},"nodes":["1b7776e00ac3ec70","18c2461f0fc5e527","c813601e240cfca6","543b0180502341b6","81116489afb6ecc2"],"x":74,"y":819,"w":512,"h":242},{"id":"1b7776e00ac3ec70","type":"server-events","z":"12b919271b59722d","g":"aee6dc901396d8ee","name":"Steve's Office Sensor","server":"2be748d3.da7088","version":2,"eventType":"","exposeToHomeAssistant":false,"eventData":"{\"entity_id\": \"binary_sensor.steves_office_sensor_occupancy\"}","haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"waitForRunning":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"$outputData(\"eventData\").event_type","valueType":"jsonata"}],"event_type":"","x":200,"y":860,"wires":[["18c2461f0fc5e527","81116489afb6ecc2"]]},{"id":"18c2461f0fc5e527","type":"switch","z":"12b919271b59722d","g":"aee6dc901396d8ee","name":"Update occupancy \\n on or off","property":"payload.event.new_state.state","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":470,"y":960,"wires":[["cdb8a4ea2ce89919"],["05d308426b073873"]]},{"id":"c813601e240cfca6","type":"inject","z":"12b919271b59722d","g":"aee6dc901396d8ee","name":"Occupancy On","props":[{"p":"payload.event.new_state.state","v":"on","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":960,"wires":[["18c2461f0fc5e527"]]},{"id":"543b0180502341b6","type":"inject","z":"12b919271b59722d","g":"aee6dc901396d8ee","name":"Occupancy Off","props":[{"p":"payload.event.new_state.state","v":"off","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":1020,"wires":[["18c2461f0fc5e527"]]},{"id":"81116489afb6ecc2","type":"debug","z":"12b919271b59722d","g":"aee6dc901396d8ee","name":"debug 84","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":480,"y":860,"wires":[]},{"id":"4c574dfc6ae7f0b2","type":"group","z":"12b919271b59722d","name":"Ignore if too bright already","style":{"label":true},"nodes":["cdb8a4ea2ce89919","f23b85b35275551b","1918c78a6bed8cc8"],"x":674,"y":819,"w":512,"h":122},{"id":"cdb8a4ea2ce89919","type":"ha-get-entities","z":"12b919271b59722d","g":"4c574dfc6ae7f0b2","name":"Occ On/Get Illuminance","server":"2be748d3.da7088","version":0,"rules":[{"property":"entity_id","logic":"is","value":"sensor.steves_office_sensor_illuminance","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":810,"y":900,"wires":[["1918c78a6bed8cc8","f23b85b35275551b"]]},{"id":"f23b85b35275551b","type":"switch","z":"12b919271b59722d","g":"4c574dfc6ae7f0b2","name":"Illuminance < 900","property":"payload[0].state","propertyType":"msg","rules":[{"t":"lt","v":"900","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1070,"y":900,"wires":[["2cd1af3c65280cfc"]]},{"id":"1918c78a6bed8cc8","type":"debug","z":"12b919271b59722d","g":"4c574dfc6ae7f0b2","name":"Illuminance","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0].state","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":860,"wires":[]},{"id":"b54d3c1ccee091eb","type":"group","z":"12b919271b59722d","name":"Handle Lights Off ","style":{"label":true},"nodes":["29cc36fd30c1454e","469626afeb0147a0","3d6c2cc39f676159","a287a63c97e400d4","36cb83176733b286"],"x":694,"y":979,"w":722,"h":122},{"id":"29cc36fd30c1454e","type":"ha-get-entities","z":"12b919271b59722d","g":"b54d3c1ccee091eb","name":"Get state of steves offices light group","server":"2be748d3.da7088","version":0,"rules":[{"property":"entity_id","logic":"is","value":"light.steves_office","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":870,"y":1020,"wires":[["469626afeb0147a0"]]},{"id":"469626afeb0147a0","type":"switch","z":"12b919271b59722d","g":"b54d3c1ccee091eb","name":"Lights group off?","property":"payload[0].state","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1050,"y":1060,"wires":[["3d6c2cc39f676159","a287a63c97e400d4"]]},{"id":"3d6c2cc39f676159","type":"debug","z":"12b919271b59722d","g":"b54d3c1ccee091eb","name":"debug 89","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","statusVal":"","statusType":"auto","x":1240,"y":1020,"wires":[]},{"id":"a287a63c97e400d4","type":"change","z":"12b919271b59722d","g":"b54d3c1ccee091eb","name":"scene=walk in","rules":[{"t":"set","p":"payload.scene","pt":"msg","to":"Steve's Office Walk In","tot":"str"},{"t":"set","p":"payload.entity_id","pt":"msg","to":"scene.steve_s_office_walk_in","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":1060,"wires":[["36cb83176733b286"]]},{"id":"36cb83176733b286","type":"link out","z":"12b919271b59722d","g":"b54d3c1ccee091eb","name":"link out 1","mode":"link","links":["c5ab7f99446aac33"],"x":1375,"y":1060,"wires":[]},{"id":"3d36e02199aa710b","type":"group","z":"12b919271b59722d","name":"Handle Occupancy Off signal","style":{"label":true},"nodes":["feb89c0e9f70b986","77751e2559e80cc9","2eecfb3287bb0821","05d308426b073873","26b0aa1e1309b9e9","5c997db9408fbc41"],"x":674,"y":1179,"w":722,"h":222},{"id":"feb89c0e9f70b986","type":"ha-get-entities","z":"12b919271b59722d","g":"3d36e02199aa710b","name":"Occ Off/Get state of HLP steves offices scene","server":"2be748d3.da7088","version":0,"rules":[{"property":"entity_id","logic":"is","value":"input_text.steve_s_office_last_scene","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":880,"y":1280,"wires":[["77751e2559e80cc9"]]},{"id":"77751e2559e80cc9","type":"switch","z":"12b919271b59722d","g":"3d36e02199aa710b","name":"HLP: Walk In scene on?","property":"payload[0].state","propertyType":"msg","rules":[{"t":"eq","v":"Steve's Office Walk In","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1030,"y":1360,"wires":[["2eecfb3287bb0821","26b0aa1e1309b9e9"]]},{"id":"2eecfb3287bb0821","type":"debug","z":"12b919271b59722d","g":"3d36e02199aa710b","name":"debug 86","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0]","targetType":"msg","statusVal":"","statusType":"auto","x":1240,"y":1320,"wires":[]},{"id":"05d308426b073873","type":"delay","z":"12b919271b59722d","g":"3d36e02199aa710b","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":760,"y":1220,"wires":[["feb89c0e9f70b986"]]},{"id":"26b0aa1e1309b9e9","type":"change","z":"12b919271b59722d","g":"3d36e02199aa710b","name":"scene=off","rules":[{"t":"set","p":"payload.scene","pt":"msg","to":"Steve's Office Off","tot":"str"},{"t":"set","p":"payload.entity_id","pt":"msg","to":"scene.steve_s_office_off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":1360,"wires":[["5c997db9408fbc41"]]},{"id":"5c997db9408fbc41","type":"link out","z":"12b919271b59722d","g":"3d36e02199aa710b","name":"link out 6","mode":"link","links":["c5ab7f99446aac33"],"x":1355,"y":1360,"wires":[]}]

I need a little help in the Handle Dim Up / Down section.

Currently, if the scene office on was activated (only two lights are on), the dim down reduces ceiling and standard lamp brightness, but at the same time turns on workbench light. What I am trying to do is for the dim up and dim down to only affect lights in the office lights group that are turned on.

The Dim up command uses service turn_on on the lighting group with { “brightness_step” : 30 , “transition” : 1}. How do update the service call to filter out the lamps that are off?

regards
Steve

You can use a get entities node before the call-service. Use the conditions “in group” and “state on”. Then format the result with JSONata in the call-service node or like example one.

Thank you @Kermit , that was exactly what was needed!

The flow now correctly updates only the active lights. I did find that when holding dim up or dim down node-red would not always keep up. This can be problematic if I send several dim commands and finally decide to turn off the lights via the PWR button. As node-red is asynchronous the results are not always right. Are there ways to queue or flush other actions so that I can be surer of the outcome?

Steve