Periodic-lights icon indicating copy to clipboard operation
Periodic-lights copied to clipboard

Is it possible to set individual colors for e.g. start, end or sleep mode?

Open 10bn opened this issue 3 years ago • 9 comments

Is it possible to set individual colors for e.g. start, end or sleep mode?

10bn avatar May 18 '21 21:05 10bn

The sleep_color allows you to set the color using a string. For example:

sleep_color: 'red'

The start and end times currently do not support colors.

haberda avatar May 20 '21 21:05 haberda

yes, i read it in the docs. Is there a list of colours one can set using the string? Would you consider allowing hs or xy colour codes for sleep_color, start end end times?

10bn avatar May 21 '21 07:05 10bn

The way the code works is it just passes the color string to Home Assistant as a service call. This means that the colors supported should be the same as the colors you can use under the color_name key under the light service call. The Home Assistant docs list the colors on this page as the supported colors.

In terms of xy colors, there is currently no support for xy color codes in the code. I could add them but it would take some work. I am working on an update right now, it probably won't make that, but maybe the next release.

As far as colors at the start and end times, I don't understand how you would expect it to work. Maybe you can clarify. The reason I say that is as soon as the code updates the colors would be changed anyway. The code sets the color temperature continuously, so if you told it to set the color to blue at the start time, the next update would change it to a color temperature.

The reason why I support a color to begin with is the sleep settings are basically a 'mode' where the light settings are static for some period of time. The same is not true of the start and end times.

haberda avatar May 21 '21 16:05 haberda

thank you for the detailed response. I'll try, if I can get my so much used to warm orange glow like this. :)

As far as colors at the start and end times, I don't understand how you would expect it to work. Maybe you can clarify. The reason I say that is as soon as the code updates the colors would be changed anyway. The code sets the color temperature continuously, so if you told it to set the color to blue at the start time, the next update would change it to a color temperature.

I would expect it to do a smooth transition (fade) from my starting colour to my end time colour through out the day. It wold be nice to have a little more influence on the colour tone of the transition in general. But after all that would be more like a nice to have thing since it's my personal favour to change those colours a little.

10bn avatar May 21 '21 23:05 10bn

Ok, yeah, I see what you're saying. It should be relatively easy to do. When I have some spare time I will try and get it working.

haberda avatar May 23 '21 21:05 haberda

I would appreciate it, thank you for considering it.

10bn avatar May 24 '21 15:05 10bn

I created a beta release for version 3.0. It contains the ability to define XY colors for min/max much like the color temperature is currently defined (notably not start/end time).

If you can test the beta that would be great. I assume you use HACS, if so you can enable beta releases for this repository in HACS and it should download. From the very limited testing I did it seems to work. You will need some new configuration options. Here is an example:

xy_test:
  module: update_lights
  class: update_lights
  entities:
    - light.living_room_lamp
    - light.living_room_lamp_2
  color_unit: 'xy'
  color_max: 
    - 0.45
    - 0.5
  color_min: 
    - 0.8
    - 0.3

Other options should work as before, but note the color_unit, color_max, and color_min, options that are required to get xy working.

Let me know if you have any issues; I will continue to test and release if all is stable for a couple weeks.

haberda avatar May 29 '21 23:05 haberda

thank you, I'll try it asap. :)

10bn avatar Jun 21 '21 22:06 10bn

Sorry for the late reply but every time I start playing with home assistant a full weekend is gone most likely and this has to be well planed. ;)

I just startet testing it and it seems to work great so far! Once again thank you for picking this up. :)

I would very much appreciate it, if you could add as well sleep_color_unit: 'xy' & sleep_brightness_level.

For the ease of use I could imagine it to be nice, if we could combine e.g color_min and color_temp_max. The way is use your integration is to allow me having a very warm glow in the early morning and late evening while having normal color temps through out the day. I could also imagine the ability to set n (multiple) markers on the timeline with color and brightness instructions. A possible scenario could be:

wakening up --> still waking up  --> the day starts --> noon --> wind down --> bed time (red hour) --> sleep mode

I saw "red_hour" in the example in the readme.md but not in the documentation. Has this been deprecated?

10bn avatar Jul 18 '21 10:07 10bn