Help with Automation with 2 conditions

I have 2 floor lights.
At 22:00 they are dimming to 30%.
Some times only 1 light is on. So at 22:00 only that light needs to dim to 30%. The other light needs to stay off.

So this is how it supposed to be:

- trigger: at 22:00

- condition 1: if the left light is on
  - action: dim the left light to 30%

Continue to check the other light <- this is where I need help :)

- condition 2: if the right light is on
  - action: dim the right light to 30%
trigger:
  platform: time
  at: '22:00:00'
condition:
  condition: state
  entity_id: light.left
  state: 'on'
action:
  - service: light.turn_on
    data:
      entity_id: light.left
      brightness_pct: 30
  - condition: state
    entity_id: light.right
    state: 'on'
  - service: light.turn_on
    data:
      entity_id: light.right
      brightness_pct: 30

Thanks for the quick reply.
But what about if the right light is on and the left light si off?

trigger:
  platform: time
  at: '22:00:00'
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: light.left
            state: 'on'
        sequence:
          - service: light.turn_on
            data:
              entity_id: light.left
              brightness_pct: 30
  - choose:
      - conditions:
          - condition: state
            entity_id: light.right
            state: 'on'
        sequence:
          - service: light.turn_on
            data:
              entity_id: light.right
              brightness_pct: 30

See: https://www.home-assistant.io/docs/scripts#choose-a-group-of-actions

1 Like

Then that would not be what you asked for.

2 Likes