Only active scene for inactive lights

Is there a way to active a scene, and only let this scene activating the lights that were inactive?

Example:
I create the following scene:

  • Kitchen light to warm white 20% brightness
  • Livingroom light to warm white 20% brightness

When the scene is triggered by a automation, I would like to check if the Kitchen light or Livingroom licht already active. So for instance, if in this scenario the Livingroom light is already active with cold white 40% brightness and the kitchen light is off, the scene should only active the Kitchen light to warm white 20% brightness and don’t change the livingroom light.

Is this possible?

Make a scene for each light/area and do your check in an automation?

Thank you @brooksben11 for your response. I do want to make an automation for this, but I would like to make this automation as clean as possible. So I was searching if there is a way to do this without making checks and scene per light(group).

On each action, you can do a choose, or an if-then and check if the light is on

@Holdestmade thanks, but when I do it this way, it means that I need to create a seperate scene for each scenario, or is there another way?

On each of you actions in the script, add an if then to check the light is on, and only run that if it is

Edit: sorry, misread, though you were using scripts

@Holdestmade can you maybe give me an example? I do not understand exactly what you mean. When I check if the light is on and only run when the light is on, than the light that is on will be changed by the scene. That’s not what I want.

I only want the lights that are off when triggered, to be turned on and set to the configuration of the scene. The lights that where already on when triggered, should be left on and NOT set to the configuration of the scene.

Something like this ?

alias: New Script
sequence:
  - if:
      - condition: state
        entity_id: light.living_room_floor_lamp
        state: "off"
    then:
      - action: light.turn_on
        metadata: {}
        data:
          brightness_pct: 100
          kelvin: 3041
        target:
          entity_id: light.living_room_floor_lamp
  - if:
      - condition: state
        entity_id: light.living_room_table_lamp
        state: "off"
    then:
      - action: light.turn_on
        metadata: {}
        data:
          brightness_pct: 56
          kelvin: 4695
        target:
          entity_id: light.living_room_table_lamp

Thanks @Holdestmade that looks promising, what you suggest is to make a script with if-then statements and configuration per light in the script instead of using scenes, right? I don’t have experience with writing scripts, but your example looks like a good base to start from.

I don’t use scenes, so not sure if you can do similar with them in conjunction with automations

1 Like