basnijholt / adaptive-lighting

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

Sunrise ramp-up speed different from sunset ramp-down speed? #813

Open osmaa opened 9 months ago

osmaa commented 9 months ago

Have you ever considered separating the adjustment speed of sunrise and sunset? This would be beneficial for using adaptive lighting for wake-up lights. For example:

Wakeup might be preferred to start at minimum brightness and color temperature, but ramp up both brightness and coldness of the light within, say, just 15 minutes synchronized to an alarm.

Wind-down on the other hand might start an hour before sunset and continue an hour after sunset to minimum brightness and warm lighting.

The tanh and linear modes could achieve this, were the morning/evening time parameters separately adjustable. OTOH, it seems that the current brightness_mode_time_dark and brightness_mode_time_light parameters are somewhat redundant given the ramp time window can also be shifted using the sunrise and sunset offsets.

jtcressy commented 6 months ago

+1 on this. been struggling with a half-baked wake-up/wind-down automation for months. quite an iron-triangle situation. I want to have my cake and eat it too!

It would be nice to have something like the following options:

then as OP suggested, combine with existing options sunrise_offset and sunset_offset to shift the ramp period around the sunrise_time and sunset_time.

also, for the sake of completeness, maybe brightness_mode could also be split between sunrise and sunset in case you wanted to have a linear ramp in the morning and a tanh ramp at sunset.

ncd7 commented 5 months ago

I was about to make the same request and glad I found yours. We 100% need a way to control the sunrise and sunset individually for reasons mentioned above.

danishru commented 3 months ago

+1 I'm also looking for a way to make the light temperature change at different speeds. For example, Apple Homekit adaptive lighting uses different times and speeds to adjust the light temperature depending on the position of the sun and/or time. I plotted the Apple Homekit adaptive lighting operation and compared it with these AL. AL uses sunrise and sunset exclusively, but I would also like adjustments for dawn and dusk. Are there any ways to configure AL the same way? image_2024-04-08_10-29-50

basnijholt commented 3 months ago

@danishru, could you in some way extract the numerical values for the Apple HomeKit curve? We could implement something similar for AL.

danishru commented 3 months ago

@danishru, could you in some way extract the numerical values for the Apple HomeKit curve? We could implement something similar for AL.

Yes, here is the history.csv this curve to csv file from Home Assistant. The time in the csv is for UTC±00:00, but my chart is using UTC+3. At the beginning of the graph and in the data, the value is less than "3000" and "unknown", they can be deleted, since they appeared when the lamp was turned off.

I suspect that Apple HomeKit builds a much more complex temperature curve, and my graph is only a special case. I could not find a description of the algorithm and logic, perhaps the community can help with this. If necessary, I can repeat the values recording of the Apple HomeKit adaptive light.

If we can replicate this in AL, it will be an even better user experience.

ncd7 commented 3 months ago

Actually - I made a suggestion elsewhere but I think what this addon is missing a totally "custom" mode where you can set an arbitrary set of time/brightness/color tuples of points and let the addon interpolate between them. So you have the "auto" modes with linear/tanh/etc and the 'custom' where you do whatever the heck you want :). This way we keep the number of these custom requests to a minimum. I think my suggestion will solve all of those rather than introducing more and more complexity to the "auto" modes.