Circadian Lighting [Custom Component]

Hi,

Is it possible to change interval between color updates in frontend (ie. with something like an input number)?

@MarshallCS @Emphyrio I would be very interested in seeing any research that graphs natural lighting color temperature throughout the day. Everything I have seen represents the natural light cycle as parabolic/sinusoidal, but that’s likely a simplified representation. I have a feeling, however, that the behavior will vary greatly based upon latitude and that it would be quite challenging to write an algorithm that calculates behavior properly at any given latitude. My suspicion is that the current implementation is the best compromise for all users, but I’m open to any fact-based suggestions.

@Petrica It’s not possible in the current implementation, and to be honest I don’t know if there’s anything I could do to make it possible. As far as I know, the methods available to schedule the code to run every “N” seconds do the scheduling when the python code initializes on boot, so there would be no way for this to change without a reboot.

I’ve tested version 1.0.9b: the light-bulb(s) transitions fast when the connected circadian-switch is switched on.
For the rest, no abnormal behavior was noticed.
So :+1: from my side.

Thanks for the reply.

Found some workaround: instead of setting each individual light as CL enabled (this is great when it works; however, case of a reboot or HA restart, it ends up with several minutes of RPITA flickering) I set a virtual light with CL for which delta in state updates (except for on and off) are forwarded to the command topic of physical remote ID paired with all the lights in the house (and can also apply optional transitions non dependent on CL).

This way I can both disable CL (by turning off the virtual light or the circadian switch) when I need to adjust color outside of CL and/or control time interval by which color changes are applied (from immediate to quarter/half/etc. of an hour) without any flickering.

However, it is dependent on specific light integration (MiLight emulator hub with MQTT json schema).

Thanks for the consideration.
I found a white-paper from sigma-luminous lighting that might useful to you

I think that paper describes in better detail what I’m seeing.

I have read that before, unfortunately there’s a few issues.

  • Most notably, according to them, other than from ~1pm-~7pm the color temperatures are above 6500k - most smart lights I know of can’t get much higher than that.
  • The graphs completely leave out 12am-6am.
  • Perhaps I missed it, but I don’t see a source cited for the data behind the graphs. I only see sources correlating color temperature and human rhythm
  • No mention is made of what latitude/elevation the claimed color temperature levels were measured at
  • The lights they’re trying to sell don’t actually accurately emulate natural light, as can be seen by the last graph

There’s some good general information there, but really it’s just a sales document - not something I can base this project on.

From what I understand, the angle of the sun through the atmosphere has the greatest effect on color temperature. What I really need is a formula that can calculate color temperature based on the altitude of the sun - that would allow CL to be much more accurate, shifting behavior based on location and season (i.e. when solar noon is lower, maximum color temperature will stay lower)

EDIT: The most useful information I’ve found have been here and here. It’s going to be a while before I can devote the time to fully understanding those equations and adapting them to return the values needed - I welcome any help in that matter.

Sorry for the delay, I was on vacation. I have tested your changes. If I add the binary sensor as a disable entity the lights are no longer adjusted when I turn on the color mode so the first part works. However the switches get stuck, they don’t adjust whites when I set the lights back. Is this the expected behavior? Should I use automations to turn the switches off and back on instead of using disable entity?

How exactly are you setting the lights back?

I’m setting them to a white that is supposed to be adjusted because it’s too bright. The binary sensor switches to off so it should work. I restarted the server and even then it wasn’t adjusted. If I turned the light off and back on it came online with the right temperature. (It reads the temperature from the sensor when it is switched on.) Looks like something is broken at the periodic adjustment.

Oh, I pushed out 1.0.9b while you were on vacation, did you install that or are you still on the 1.0.8b I originally linked to? If the binary sensor is switching back to off it should work on 1.0.9b.

I tried 1.0.8b. I’ll try 1.0.9b as soon as I have a chance.

How do I disable your component if a scene, which changes the temperature of a light, is activated?

You’d have to use an automation that turns off the CL switch when the scene.turn_on service event fires. Trigger Automation when Scene is triggered would be a good starting point.

1 Like

1.0.9b works like a charm. Thanks for all the effort you put into this.

This is fantastic! I just added some hue bulbs to the circadian switch and it looks great.

Is there a way to reset lights to their previous status when switching the switch off? I use some of my lamps to display certain statuses (for example, turn color x when task 1 is supposed to be worked on).

I realized when the switch is turned on and I change one bulb’s color, it will turn to that color for a second or two, then switch back to circadian light (which is fine, as the switch for circadian light is turned on!). But when I then switch circadian light off, the bulb will stay at the last color it has been set to by circadian light. Let’s say I turn my bulb to purple; home-assistant will color it’s icon purple, even though circadian light turned it white after a second; when I then switch off circadian light, home-assistant will still display the bulb as purple, but it is still white.

Yes, this is possible, but wouldn’t it be easier to just turn the CL switch off before setting the status color of the light?

Bit late but I wanted to say thank you!
Every now and then the color doesn’t update when changing between the built in night mode and back. Otherwise great.

Hi! And first of all, this is a really neat component, thank you!

I’m having this issue where brightness control stops working, and all of the lights stay at 100% brightness. Color temp change works just fine. When I’ve reinstalled Hassio, reloaded the config, placed the same files in the custom components location, it has returned to working fine again… so I’m starting with ruling those out.

Any ideas – did I miss something obvious in this comment thread? Thanks a bunch!

Brightness should be at max_brightness from sunrise to sunset, and will only change brightness level from sunset to sunrise. This is not the behavior you’re seeing?

Will the period of max_brightness shift with sunrise_offset and sunset_offset?