A little help is needed with light automation

I would like to get some help with the following automation:
Turn light on 01:15:00 before Sunrise, but not earlier than 05:50u.

- id: turn_lights_on_01
  alias: 'Turn lights on'
  trigger:
    - event: sunrise
      offset: '-01:15:00'
      platform: sun
    - at: "05:50:00"
      platform: time
  condition:
    - after: '05:50:00'
      condition: time
    - after: sunrise
      condition: sun
  action:
    - service: light.turn_on
      entity_id: light.dimmable_light_1
      data:
        brightness_pct: 50
    - service: switch.turn_on
      entity_id:  switch.on_off_plug_in_unit_1

Sunrise today was at 07:00u and nothing happend this morning.
I can see this automation doesn’t work but I don’t know how to solve it. :thinking:

I do have couple of additional questions:

  • ‘brightness_pct’ will be depreciated soon, how to do this in the near future?
  • I’m having a second automation to turn the light off again 1hr after Sunrise. Can this be combined/added in the automation above?
  • Is it possible to add a Motion Sensor and increase ‘brightness_pct’ for lets say, 2 min when motion is detected during the time lights are on? At the moment I’m doing this with third and fourth automation.

Thanks in advance!

5:50:00 isn’t after 5:50:00, so that trigger will never happen. And

7:00 am minus 1:15 is 5:45. So both your triggers fail.

You should split this into 2 automations. 1 Automation will turn it on 1 h 15 minutes before sunrise if the lights are off and if it’s past 5:50 am. The second will turn them on at 5:50 if they are off and if it’s after 1 h 15 minutes before sunrise.

- id: turn_lights_on_01
  alias: 'Turn lights on 1h15m before sunrise'
  trigger:
    - event: sunrise
      offset: '-01:15:00'
      platform: sun
  condition:
    - after: '05:50:00'
      condition: time
    - condition: state
      entity_id: light.dimmable_light_1, switch.on_off_plug_in_unit_1
      state: 'off'
  action:
    - service: light.turn_on
      entity_id: light.dimmable_light_1
      data:
        brightness_pct: 50
    - service: switch.turn_on
      entity_id:  switch.on_off_plug_in_unit_1

and

- id: turn_lights_on_02
  alias: 'Turn lights on at 5:50'
  trigger:
    - at: "05:50:00"
      platform: time
  condition:
    - condition: sun
      after: sunrise
      after_offset: "-01:15:00"
    - condition: state
      entity_id: light.dimmable_light_1, switch.on_off_plug_in_unit_1
      state: 'off'
  action:
    - service: light.turn_on
      entity_id: light.dimmable_light_1
      data:
        brightness_pct: 50
    - service: switch.turn_on
      entity_id:  switch.on_off_plug_in_unit_1

Thanks @petro! :+1:
I made it too difficult for myself trying to include everything in one automation.
My next challenge will be using the Sun Elevation and Sun Azimuth I think.