Sunrise/sunset help

I have a simple automation that will turn the light on before sunrise and after sunset from motion. However the boss has ever so politely requested this be altered as it’s still dark at sunrise. I would like to alter it so the automation will run for a further 45 minutes after sunrise and 45 minutes before sunset. Have I got it right with this?

condition: or
  - condition: sun
    before: sunrise
    before_offset: '+00:45:00'
  - condition: sun
    after: sunset
    after_offset: '-00:45:00'

Please see topic #9 on How to help us help you - or How to ask a good question

    - id: 'turn_off'
      platform: sun
      event: sunrise
      offset: "+00:45:00"
    - id: 'turn_on'
      platform: sun
      event: sunset
      offset: "-00:45:00"

these should be your triggers…
never the less - your question is nearly exactly an example within the documentation
so please check: Automation Trigger - Home Assistant (

Sorry typed it on my phone and it failed to paste correctly. Have edited post

I have them as conditions not triggers. I don’t want the light to come on just because of the time of day. I want the motion sensor to be the trigger but it only trigger before sunrise/sunset so I assumed a condition would be what I wanted?

OP is not talking about turning lights on/off during time period, but on motion when sun is down. So it’s a condition, not a trigger.

Ah sorry - then I understood your question wrong.
But your edit looks fine - does it not work?
If not - would be great if you could poste the whole automation because it does not seem that the condition is the failing part