hass-circadian_lighting icon indicating copy to clipboard operation
hass-circadian_lighting copied to clipboard

Added 'transition colortemperature'

Open Appesteijn opened this issue 4 years ago • 5 comments

I didn't like that the color temperature would switch to 'min_colortemp' when the sun sets or rises. I wanted to have a more subtle transition between day and night.

So I added an optional 'transition_colortemp' setting that determines what the colortemperature should be when the sun sets or rises. If it is not defined, behaviour should not change. This change is backwards-compatible.

My config settings (with Ikea Tradfri lights on Philips Hue):

circadian_lighting: min_colortemp: 2200 transition_colortemp: 2700 max_colortemp: 4500

So during the day transition is from 4500 to 2700, when the sun sets it goes from 2700 to 2200.

Appesteijn avatar Dec 08 '19 20:12 Appesteijn

Upvoting this to be merged into the main branch. It is quite jarring that the color temperature drops to the minimum when the sun sets - would be great if we could define a sunset color temperature and the minimum color temperature so that there is a smoother transition overnight to that target.

igiannakas avatar Jan 14 '20 20:01 igiannakas

I will review as soon as I have time. Sorry for not responding sooner.

I'm not going to guarantee that this is going to be merged, however. The entire purpose of Circadian Lighting is to maintain your body's natural rhythm - most of the decisions I have made in regards to functionality are based on the scientific research I have studied. Circadian Lighting is not designed to be an aesthetic mechanism and my general position is that I will not change or add functionality simply because of personal preference.

I don't want to sound harsh or closed minded but I do need to keep the core mission in mind. I'm not completely ruling out this PR, but I have to take time to research and consider the implications, more than just that the code is functional. I'm open to looking at any scientific papers you can find that suggest that natural color temperature varies after the sun sets, or that implementing such a mechanism is advantageous for maintaining your natural rhythm.

claytonjn avatar Jan 16 '20 00:01 claytonjn

Sorry I don't have any research to back this - however what I have noticed from my personal experience is that its helpful to continue to transition the lights to a warmer temperature at night as you prepare to go to bed. Research states that warm temperatures at night are helpful so going warmer than warm white should be OK circadian wise?

In the UK where I live, sunset during the winter is as early as 15:00. What happens in practice is that if I set the minimum colour temperature to 2200K which is ideal to unwind before going to bed (think candle light), its too warm for the afternoon where I want something more akin to 2700K (incandescent) to have dinner.

I've played around with offset timings but the curve from 5500K to 2200K is just too steep and the resulting transition way too quick. Also it results in the wrong temperature light for the time of day. In contrast having a 3k target when sun sets and a 2200k target at midnight results in a fast slope during the day and a slow slope during the night, from warm white to candle light like white, making the transition from daylight, to dusk to bed time a lot smoother. See below the resulting graph: Screenshot 2020-01-16 at 11 14 56

igiannakas avatar Jan 16 '20 10:01 igiannakas

It sounds like for your use case you'd be best off just configuring sunset_time and probably sunrise_time instead of using the offsets. That way you can set it so it's getting to min_colortemp right as you go to bed and the time between sunrise and sunset would be much longer with less steep transitions. To be honest, that's probably what most people should do because that would result in consistent behavior all year round - most people's sleep/wake schedule doesn't change with the season.

You're right though, that this likely wouldn't have negative impacts. So the only real hesitation I have against merging would be that CL is already relatively complicated and requires a lot of description for each option. I really need to find the time to allow configuring CL through the integrations panel so that it can be a more step-by-step process...I digress. Anyway, I will likely merge, just need to get some free time to look it over and do some quick testing.

claytonjn avatar Jan 17 '20 01:01 claytonjn

I'm now experimenting with some hue sensors to measure light in the house and I do want the lights to turn on during the day (when it get dark) but I don't want them to be on max_brightness. I would like to 'feed' the lux levels of my Hue sensors into this plugin to determine brightness, but small steps :)

Appesteijn avatar Mar 24 '20 20:03 Appesteijn