Sunrise logic changed with a recent core update?

I have an automation with these conditions:

condition: and
conditions:
  - condition: or
    conditions:
      - after: sunrise
        condition: sun
        after_offset: '-2:00:00'
      - before: sunset
        condition: sun
alias: nicht abends

The point is that this should not pass in the evening/at night. But it somehow does since I updated HA core to a later version. It passes at 1am because the before sunset–condition is true then, even though the after sunrise–condition isn’t. Or perhaps I configured this condition incorrectly all along? I’m wondering what the or–building block is even good for here. I think I should omit it, shouldn’t I?

  • Core2025.5.1
  • Supervisor2025.05.1
  • Operating System15.2
  • Frontend20250509.0

The two conditions are logical ORed so as long as one of them is true the ultimate result will be true.

Perhaps what you want is this one condition:

- condition: sun
  after: sunrise
  after_offset: '-2:00:00'
  before: sunset

The time must be in the daytime between sunrise (2 hours before sunrise) and sunset.

1 Like