Not sure if I understand this correctly. Do you want the condition to be true from 30 min before sunrise to 30 min after sunset or should it be false during this time?
What you currently have will be true from 30 min before sunset until 30 min before the sun rises.
No matter which way you want, you need to remove the space between after_offset and : and between before_offset and :
Your other option is using the elevation attribute of sun.sun, and a simple numeric state condition.
If you check just now what 30 minutes after sunset is in elevation terms, then that light level will be consistent through the year (the time offset won’t), and your condition becomes a much simpler:
Thanks @Tinkerer, indeed I have looked into elevation attribute but I have to say I didn’t understand it!
I already modified the automation using sunrise/sunset in order to be indipendent from the time.
I can try an automation, just to check that “-1” really means, in terms of elevation.
I agree with Tinkerer,
Unless you actually want sunset or sunrise the ‘time offsets’ are often (when guestimating light level) highly variable (and the degree depends on your latitude).
1 in this context is 1°
Solar angle is a much better indicator
But there are a couple of things to bear in mind, the sun doesn’t ‘set’ until the top is seen to be level with the horizon and it hasn’t risen until the top is seen to be level with the horizon.
I say “seen to be” for both as the atmospheric lens effect alters the perceived position of the sun which at these times sums and equate to a - 0.86° offset.
Civil dawn is - 6 degrees and gives a generally accepted walking level of light but you should suck it and see