According to the documentation numeric_state should fire when numeric value of an entity’s state crosses a given threshold. What they do. But they also fire on a restart of the system. How can I prevent them from being fired after a restart of HA?
Is that because it takes time to figure out the sun position and it reports 0 as default?
Can you try and restart and see what the number is when it’s fresh restarted?
If it is then maybe you can use the uptime as condition.
Say 5 minutes of uptime?
It could be a split second of the value being 0.
Perhaps if you remove this condition again and add a action to notify and the message is the sun variable.
That way you can see when it triggers you get a notification with what the state was at that time.
Have you considered a hardware solution? I have a number of Wireless Tags on doors and windows to sense opening, temperature, humidity etc.These can be armed and disarmed via Home Assistant, so I am using a spare one as a Night/Day flag (armed at night, disarmed during the day). The tag retains its value when HA is rebooted, so an automation can have a condition which checks the status of the flag before the rest of it runs.
In fact, each tag has three arming switches which can be on or off, so there’s quite a lot of scope for different uses. You just have to remember to change the batteries every couple of months, or everything grinds to a halt.
It works well enough for me with the sun.sun sensor. And I can work around the reboot issue with the mentioned condition. It’s just that I think that it is not the expected behavior to fire the automation after a reboot. But on the other hand I don’t know if it is a bug worth writing a bug report. Maybe it’s a feature and I missed it…