Sunrise oddity - automation condition

Hi. I’ve got the time zone set correctly in HA and sun.sun is reporting a correct sunrise time:
Screenshot 2021-09-01 at 05.38.34

But now, i have added a following condition to an automation:

condition: sun
after: sunset
before: sunrise

And it doesnt seem to work an hour before sunrise:
Screenshot 2021-09-01 at 05.40.56

What may be causing this oddity?
Seems that sunrise condition in automations takes GMT timezone, but everywhere else the timezone is set correctly to BST.

Classic mistake. The sun can’t be before sunrise and after sunset at the same time.

condition:
  condition: or
  conditions:
    - condition: sun
      after: sunset
    - condition: sun
      before: sunrise

Ha! That makes absolute sense.
Forgot about that while redoing my automation in GUI.
But to be honest, if GUI automation editor allows me to select both before and after, i would assume that it should format the YAML correctly

It’s not a question of YAML formatting. You created a single Sun Condition with two options. That’s exactly what the Automation Editor produced. Francisp showed that the correct way to do it is to create two Sun Conditions that are logically ORed. That’s not a mere formatting difference it’s a completely different conditional expression.

In your case, you may wish to consider using a State Condition.

condition:
- condition: state
  entity_id: sun.sun
  state: 'below_horizon'