basnijholt / adaptive-lighting

Adaptive Lighting custom component for Home Assistant
https://basnijholt.github.io/adaptive-lighting/
Apache License 2.0
1.71k stars 127 forks source link

Add daycycle to brightness calculation #881

Open GitPeterJ opened 7 months ago

GitPeterJ commented 7 months ago

So I love/hate this component (or finding the perfect light setup in general), but the problem arises every summer and winter.

Problem The right settings in the summer don't work well in the winter and vice versa. For example, now in the winter the sun already sets at 16:30, so the brightness_mode_time_dark needs to be set high to not be left in the dark in the evenings, but in the summer it can be set short as the sun sets at 23:00. So it needs constant tweaking year round.

Solution Add another function that can be set as a standard day cycle. What I mean by this is that I can set my normal schedule (like waking at 7:00 and going to sleep at 23:00) so that another value gets generated that takes the sum/mean/addition with the value generated from the position of the sun. This will cause the lights to not dim completely year round!

For now, I have my own solution in Node-Red that calculates this in combination with a spline-curve on the sunrise/sunset times, but would rather use this automation as it takes better control of the lights. I am also looking at changing this to the sun elevation instead of time component to get the actual color temperature/brightness (as described in this paper). What are your thoughts on this?

basnijholt commented 6 months ago

You can write an automation that changes the settings same/or set the min and max sunset and sunrise.

basnijholt commented 6 months ago

OK I read your comment in more detail now. Yes, I think having the actual (calculated) color temp based on real data would be great!

I am happy to provide help and feedback if you can find the time to make a PR.

GitPeterJ commented 6 months ago

Happy to hear your second reply! If I find the time to make an initial analysis, I will be happy to hear more ideas about the light cycle from you or maybe others who are also looking for improvements in this.

My current thoughts are: