Time offset for sun_next_rising in an automation

Getting started with Home Assistant and am creating a routine where I only want to execute an action if the time is after 12:30am and before sun_next_rising with a -30m offset (30 minutes prior to sunrise).

I’m a bit of a newbie and tried a couple of things, just trying to work out how I can integrate the offset in YAML:

2023-08-14 19_48_11

Any advice would be appreciated :slight_smile:

The offset needs to be like this -00:15:00 (Hrs mins secs) without quotes, least it is in mine.

You can’t just mash two different condition types together… Time conditions don’t have an offset configuration variable.

Use a Time condition and a separate Sunrise condition or use a Template condition.

- condition: sun
  before: sunrise
  before_offset: "-00:30:00"
- condition: time
  after: "00:30:00"
1 Like

Thank you.