Need automation help using sun conditions

This is a complete edit from my original post because I couldn’t find a way to delete it. It started as an issue with an automation error, but in looking at my automation, even if I got things to work, it wouldn’t be correct.

What I want to do is this:

  • If it is any time between 45 minutes before sunset and anytime before sunrise and

  • I turn on any activity in my Harmony Hub (harmony-api installed and working, using mqtt triggers)

  • Run two scenes, one first then another a minute later

I first tried getting the scenes to run whenever I ran an activity on the harmony hub and that worked fine. So then I added in my condition for the sun,

# MQTT/Harmony
- alias: 'Theater Lights'
  trigger:
    platform: mqtt
    topic: harmony-api/state
    payload: 'on'
  condition:
    condition: sun
    event: sunset
    offset: "-00:45:00"
  action:
    - service: scene.turn_on
      entity_id: scene.sunset1
    - delay: 00:01:00
    - service: scene.turn_on
      entity_id: scene.sunset2

And that kept generating an extra keys error

voluptuous.MultipleInvalid: extra keys not allowed @ data['offset']

But while trying to figure out the source of the error, I realized that this wasn’t correct anyway as this would only work if it was exactly 45 minutes before sunset and no other time.

Can anyone tell me how I should be setting the conditions for what I want to do? I can’t seem to figure it out on my own and I’m feeling kind of dumb!

I got the answer over on r/homeassistant from dale3h:

condition: sun
after: sunset
after_offset: "00:45:00"

“The documentation on using sun as a condition can be found here.”

I searched all over and never saw that page until Dale pointed me to it. Not sure how it’s linked in the main site but I bookmarked it. Thanks again Dale!