Dim All lights that are currently on

Id like to trigger an automation/scene that will dim all lights that are currently on. I dont want to dim the light if it is not currently on. I used to do this in smartthings, but cant figure out how to do it in HA. Im open to Node Red too, if that will work.

The automation’s action would use a service call like this:

action:
  - service: light.turn_on
    target:
      entity_id: "{{ states.light | selectattr('state', 'eq', 'on') | map(attribute='entity_id') | list }}"
    data:
      brightness_pct: 35
1 Like

thanks. That makes sense. Can anyone provide guidance on how to do this within node red in HA?

Glad to hear it.

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information, refer to guideline 21 in the FAQ.

The original question was posted in the Configuration category and you had asked how to do it with an “automation/scene”. The suggested service call will do what you requested.

If you want to know how to do something exclusively in Node-Red, it’s preferable to post it in the Node-RED category where it is more likely to be viewed by users with the appropriate expertise.

Hi

Absolute newbie here. This seems to work!
But how can I limit this to a specific room (area?). Can’t be the life of me figure it out…

action:
  - service: light.turn_on
    target:
      entity_id: "{{ area_entities('Kitchen) | select('match', 'light') | select('is_state', 'on') | list }}"
    data:
      brightness_pct: 35

Works like a breeze! Thank you!