I used to do my light automations in NodeRED and I used the golden hour component to switch on/off my lights. For me, the start of the golden hour is the perfect time to switch on my lights.
So, I would really like to see the golden hour being added to the SUN component. Currently, it’s really a pain to accomplish the same using the sun/elevation.
for the time being, this is all there is to it, no real pain at all?
binary_sensor:
- platform: template
sensors:
golden_hour:
friendly_name: Golden hour
value_template: >
{{ -4 < state_attr('sun.sun','elevation')|float < 6}} #edited the -4 to have a leading space, otherwise the jinja interpretes that as a white space killer and the template is false going below 4 ;-) )
device_class: light
and you can trigger of the state of that binary_sensor.
You can also instal deCONZ add on, even if not using it for controlling Zigbee devices,it contains daylight sensor:
The sensor’s state value is a string corresponding to the phase of daylight (descriptions below taken from https://github.com/mourner/suncalc, on which the deCONZ implementation is based):
Sensor State Description
sunrise_start sunrise (top edge of the sun appears on the horizon)
sunrise_end sunrise ends (bottom edge of the sun touches the horizon)
golden_hour_1 morning golden hour (soft light, the best time for photography)
solar_noon solar noon (sun is in the highest position)
golden_hour_2 evening golden hour
sunset_start sunset starts (bottom edge of the sun touches the horizon)
sunset_end sunset (sun disappears below the horizon, evening civil twilight starts)
dusk dusk (evening nautical twilight starts)
nautical_dusk nautical dusk (evening astronomical twilight starts)
night_start night starts (dark enough for astronomical observations)
nadir nadir (darkest moment of the night, the sun is in the lowest position)
night_end night ends (morning astronomical twilight starts)
nautical_dawn nautical dawn (morning nautical twilight starts)
dawn dawn (morning nautical twilight ends, morning civil twilight starts)
thanks! just found this thread again, because I was finally able to use the conbee and setup this sensor.
Seems a bit odd though with enormously long golden hours and nadir (which should be only a short period) taking almost all night. Astral has got those lighting scenes in a more natural way I feel.
fyi, Ive made this customization, and had a bit of a struggle with the available mdi icons. If you could see an improvement, please let me know:
Well… after some time of using this sensor I also found it a bit frustrating, that timeframes of different states are a bit… off time What I really wanted is to know when I should trigger my lights, because it is dark enough.
So finally I went completely different route for this and I created small sensor that combines sunset and cloud coverage, giving on return ‘adjusted’ sun elevation. If it is positive, it light enough not to switch the lights on, if negative I either swithc the lights on or use it as condition in automations to determine if, for example, motion detection should trigger the light on.
Here is the code: