Solar angle or sunrise/sunset?


I’ve been using the solar angle instead of sunrise/sunset with an offset for automation triggers, but I have found that if I reboot the system when the solar angle in below my defined trigger, i.e below -2 it can trigger at any point if it is below -2 and the system is rebooted.

What is the best practice please? i.e. I want it to trigger ONLY once even if it is rebooted.


What’s your automation?

I have several like this and have to put a time before and after to stop it running if there is a reboot in the early hours

- alias: 'Landing light when getting dark'
    platform: numeric_state
    entity_id: sensor.solar_angle
    below: 1.0
    condition: and
    - condition: state
      state: 'home'
    - condition: time
      after: '15:00:00'
      before: '23:00:00'
    - condition: state
      entity_id: light.landing 
      state: 'off'
    - service: light.turn_on
      entity_id: light.landing
        brightness: 100

My sunset/sunrise automation frequently triggers a couple of times on the same day.
In my case it doesn’t matter.
If it did, I would probably add an input boolean to flag on the first activation.

I think the reason is that when the system is starting it doesn’t know where the sun is.
So before it does the calculation it assumes ‘0’ which is below your level and thus triggers
I think you’d have to run a script or timer to run on reboot to stop activation until say 1 min expired ??
You might have to tweak it a bit as if it is below 1 when the timer prevents action then it may not trigger again
So it may be wise to run the evaluation and action at the end of the script regardless