Circadian Lighting [Custom Component]

From graphs presented on this component page, it seems its behaviour is exactly the same. So at sunrise, light intensity reaches maximum.

I’m not trying to argue about interpretation.
But it is not comfortable to have lights set to very bright (more than 50%) at 3 am. Personally I found it invalid. And seems I’m not alone judging after your the first response.

One would suggest to use sleep mode, but… afaik it uses lamps built-in transition feature for smooth alteration between it and light generated by circadian sensor. It causes a lot of issues, not supporting long time periods, resetting by turning on/off the lights etc. Is it implemented the same way in adaptive light? Don’t know because no examples covering this feature. Maybe it’s rendered into the sensor. Maybe not.

I hear you. I made my own automations after trying this circadian component first. My DIY automation starts at dawn.

You seem to have a pretty good grasp of the component’s options and gripes. I am not sure how we can help you though. Is there a specific question?

Thank you. Just asking if am I missing something, or trying to get reasons or possible future features which could meet my requirements,
If found nothing I will write something fit my needs obviously.

Some of my lights are controlled by standard zwave dimmers and equipped with Glowlight bulbs (those bulbs change their colour temperature when being dimmed. Will circadian lights addon support such a setup?

Yes but only for the brightness setting.

@janhub, in regards to your first question, as mentioned by @sparkydave you can disable the circadian schedule during automation’s. I do this when using a Z-Wave Aeotec nanomote control, a Z-Wave GE dimmer and a Harmony Logitech remote to change the lighting.

For your second question, I also concur with @sparkydave. To be fair the transition question also has boundaries that can often be personal. By far I am no expert to the topic, so my preferences should be taken with a grain of salt. The bulbs that I found to almost satisfy all my personal needs for this topic are made by Lifx. These bulbs paired with my WiFi configuration seem to respond very quickly and has neat features such as you can change the state of the bulbs even when they are turned off.

I do try to not have an automation where when the lights are turned on, have them dim a few seconds later, that looks weird to me, better the opposite. Prior to turning on the light I match the bulb state to the Circadian Schedule. I use different transition period pending the action or activity.

  • Manually turning on and off the lights: I use a quicker transition for this since this is what I requested and expect.
  • A partial automated request such as playing or pausing a movie, and/or a motion sensor request: I tend to keep those transitions to be of a medium duration.
  • A fully automated request such as turning the lights on at sunset: I will use a longer transition period to blend in the light request.

Now honesty requires me to say that the Lifx bulb is not perfect. This is one of those appliances/bulbs that will turn on after a power outage. More to this issue here: https://community.home-assistant.io/t/smart-bulbs-power-outages/53688 What I did to mitigate the situation: I always set the brightness at the lowest setting when I turn the lights off. Hence if the lights turns back on from a power outage it will be less noticeably and I have an automation that monitors the state of the bulbs that will turn them off.

B.T.W. Thank you to all involved in this project (HA) directly or indirectly and of course @claytonjn.

Thank you for this detailed answer! Unfortunately I spent a small fortune buying philips hue bulbs and accessories so changing the whole system isn’t an option for me.

I’m still hoping for claytonjn to find a way for everyone to have circadian lighting run with hue scenes. He seems to already have found a solution…the transitioning effect that appears after turning on a light still seems weird an unnatural to me…

Best regards!

@claytonjn @basnijholt what is the plan with the Circadian Lighting and Adaptive Lighting custum_components?

Will the Circadian Lighting component live on as a separate component? Or not?
If not maybe the topic should be locked and a new topic should be started for the Adaptive Lighting component?

First off all, Happy New Year!

This is a built in feature of Adaptive lighting (mentioned earlier)

Edit: This is only a feature when the lights are already on. But you can do this by switching off the adaptive switch via an automation first and then calling a scene/lights-on service.

So as said, i use adaptive lighting and not this component, but maybe it works this way too.

I use a node red flow to turn on my lights with a preset value of brightness and color extracted from the adaptive lighting switch:

Every 5 minutes it extracts the light and color attribute from the chosen adaptive light switch and puts it in a flow variable.

In my case, when the motion sensor turns on, it takes the values from the viariable and set it via a function node to the data of the turn-on service.

This is one of my flows.

[{"id":"4374254b.bfee6c","type":"trigger-state","z":"df3c4743.4facc8","name":"Bewegingsmelder hal keuken","server":"6b2ff5fc.18946c","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.bewegingsmelder_hal_keuken","entityidfiltertype":"exact","debugenabled":false,"constraints":[],"outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":470.0000009536743,"y":4135.000026226044,"wires":[["245373ab.22db0c"],[]]},{"id":"b722c582.93d9f8","type":"template","z":"df3c4743.4facc8","name":"Format desired office Lamp State","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n\"data\":\n{\n\n\"brightness_pct\" : {{flow.hal_brightness}},\n\"kelvin\" : {{flow.hal_kelvin}}\n\n}\n}","output":"json","x":1020.0000009536743,"y":4135.000026226044,"wires":[["b13d6964.b9d878"]]},{"id":"977fb69c.3de0e8","type":"api-current-state","z":"df3c4743.4facc8","name":"Current state - adaptive lighting switch hal","server":"6b2ff5fc.18946c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.adaptive_lighting_hal","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":690.0000009536743,"y":4055.0000262260437,"wires":[["643a6fe1.18546","c38c72f.54d021"]]},{"id":"3721e772.bb0838","type":"change","z":"df3c4743.4facc8","name":"Set brightness hal lights","rules":[{"t":"set","p":"hal_brightness","pt":"flow","to":"data.attributes.brightness_pct","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1310.0000009536743,"y":4055.0000262260437,"wires":[[]]},{"id":"643a6fe1.18546","type":"function","z":"df3c4743.4facc8","name":"Extract brightness %","func":"msg.payload = { data: {'message': msg.data.attributes.brightness_pct} };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1020.0000009536743,"y":4055.0000262260437,"wires":[["3721e772.bb0838"]]},{"id":"3372e94b.bda9f6","type":"inject","z":"df3c4743.4facc8","name":"Every 5 minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":370.0000009536743,"y":4055.0000262260437,"wires":[["977fb69c.3de0e8"]]},{"id":"b13d6964.b9d878","type":"api-call-service","z":"df3c4743.4facc8","name":"hal keuken lights on","server":"6b2ff5fc.18946c","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.hal_keuken","data":"{}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1320.0000009536743,"y":4135.000026226044,"wires":[[]]},{"id":"7b4fcd4f.fbde44","type":"trigger","z":"df3c4743.4facc8","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"1","extend":false,"overrideDelay":false,"units":"min","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":950.0000009536743,"y":4195.000026226044,"wires":[["b7672542.7d6498","b494db42.2fd578"]]},{"id":"b7672542.7d6498","type":"api-call-service","z":"df3c4743.4facc8","name":"hal keuken lights off","server":"6b2ff5fc.18946c","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.hal_keuken","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1180.0000009536743,"y":4195.000026226044,"wires":[[]]},{"id":"245373ab.22db0c","type":"switch","z":"df3c4743.4facc8","name":"on / off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":720.0000009536743,"y":4135.000026226044,"wires":[["b722c582.93d9f8","7b4fcd4f.fbde44","b494db42.2fd578","b13d6964.b9d878"],["7b4fcd4f.fbde44"]]},{"id":"495d3a85.beb8dc","type":"api-current-state","z":"df3c4743.4facc8","name":"Hal keuken aan?","server":"6b2ff5fc.18946c","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hal_keuken","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":590.0000009536743,"y":4195.000026226044,"wires":[["ef73c04a.8b301"],[]]},{"id":"7f7a1cb0.2bbd1c","type":"switch","z":"df3c4743.4facc8","name":"enable?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"enable","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":400.0000009536743,"y":4195.000026226044,"wires":[["495d3a85.beb8dc"]]},{"id":"ef73c04a.8b301","type":"change","z":"df3c4743.4facc8","name":"on -> off","rules":[{"t":"set","p":"payload","pt":"msg","to":"off","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":760.0000009536743,"y":4195.000026226044,"wires":[["7b4fcd4f.fbde44"]]},{"id":"6092367e.567ed8","type":"api-current-state","z":"df3c4743.4facc8","name":"Hal keuken uit?","server":"6b2ff5fc.18946c","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hal_keuken","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1400,"y":4200,"wires":[[],["870f3059.3f12b","b494db42.2fd578"]]},{"id":"870f3059.3f12b","type":"api-call-service","z":"df3c4743.4facc8","name":"Hal keuken uit","server":"6b2ff5fc.18946c","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.hal_keuken","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1600,"y":4200,"wires":[[]]},{"id":"b494db42.2fd578","type":"trigger","z":"df3c4743.4facc8","name":"","op1":"","op2":"off","op1type":"nul","op2type":"str","duration":"10","extend":false,"overrideDelay":false,"units":"s","reset":"on","bytopic":"all","topic":"topic","outputs":1,"x":1150,"y":4260,"wires":[["6092367e.567ed8"]]},{"id":"c38c72f.54d021","type":"function","z":"df3c4743.4facc8","name":"Extract color temp kelvin","func":"msg.payload = { data: {'message': msg.data.attributes.color_temp_kelvin} };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1030.0000009536743,"y":4015.0000262260437,"wires":[["42113ad1.a88cf4"]]},{"id":"42113ad1.a88cf4","type":"change","z":"df3c4743.4facc8","name":"Set brightness hal kelvin","rules":[{"t":"set","p":"hal_kelvin","pt":"flow","to":"data.attributes.color_temp_kelvin","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1310.0000009536743,"y":4015.0000262260437,"wires":[[]]},{"id":"e318a928.ddd1b8","type":"link in","z":"df3c4743.4facc8","name":"","links":["c558c23c.abaf7","5702d2f7.b3162c","ea04d321.002c6","d195f63.b0e7b08","11aff9d0.7f8e6e","1d3b928a.4522a5"],"x":195.00000095367432,"y":4135.000026226044,"wires":[["4374254b.bfee6c","7f7a1cb0.2bbd1c"]]},{"id":"6b2ff5fc.18946c","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

For every room I have a different adaptive light switch. When sleepmode is on in that room it wil also use the value of the sleepmode setting.

This has made the adaptive lighting much beter for me because I also hate the changing of the lights when they on and specifically when they where off for quite some time.

p.s. I only have hue lights too, but using deconz instead of the hue hub.

@dannydwn: Oh wow! So will this also work with regular switches? (Like the hue smart button?) Like you said its just hard to get used to that light transition effect especially when the light haven’t been on for a while.

I also use adaptive lighting. But I’ve never used node red. Is there a way I can somehow copy and paste your flow? Is node red an integration for home assistant? Also do I need deconz for this to work? Or can I keep using my lights with the hue bridge?

Thanks for your answer! This really gives me hope! I really love the concept of circadian lighting.

There is an Node-red addon for home assistant, see:

It will not work with regular wall switches because they cut off the power to your light bulb. The “regular switch” you are referring to is a hue switch, which can be programmed to do a service call.

In my example my “switch” is an motion sensor (bewegingsmelder hal keuken)

For importing the flow, so you can study and / or alter it and use it, inside of node-red click on the hamburger icon in the upper right corner and choose import. Just paste te code in there and click on import.

It wil just work fine with an hue hub as long as its connected to HA and you can reach the bulbs.

For more info and the basics on Node-red just check the community and the documentation on node red’s website: https://nodered.org

For connecting hue switches from the hue hub to node-red just look for an palette in node-red called node-red-contrib-huemagic

@dannydwn Thank you. I tried your flow and changed it to my needs. I installed huemagic and my buttons/dimmers are recognized.

Pushing my hue smart button now indeed turns my light on with the correct light temperature set. However the light takes around 3 seconds to even turn on…so huge delay here…this is even worse than the transition effect hahaha :sweat_smile:

3 seconds is indeed catastrophic :sweat_smile:.

You should probably check the polling state of the huemagic contrib.

Some delay is inevitable because the hue bridge needs to get polled.

That’s why I made the switch from hue bridge to deconz. Deconz pushes the messages instead of polling.

Ok…I think I’m giving up on this transition thing. I reduced polling interval but the lag is still too noticeable. And getting into deconz is above my head. I will just patiently be waiting for the creator of this integration to maybe give more insights on his solution with hue scenes. I believe this would be the ideal way of dealing with this issue. Putting the CT and brightness values into a scene (that is updating the scene in an interval) so that all the switches just have to activate that scene.

I believe huemagic doesnt have the ability to set values for scenes?

There isn’t anything that can set a value of brightness/color temperature of a scene because a scene is a preset.

Making “scenes on the fly” is backwards of what you want. Because your saving the current light settings to a scene.

Maybe its possible to update the brightness and color temp values of a light in off state via de rest-api. But that’s something i never looked in to.

Edit:

I just tried to modify the brightness of a turned off light via the api of deconz:

[
    {
        "error": {
            "address": "/lights/21/state",
            "description": "parameter, bri, is not modifiable. Device is set to off.",
            "type": 201
        }
    }
]

Guess no luck via deconz.

Thanks for the effort of trying this. What I don’t get is, that scenes somehow seem to have the ability to make a light turn off with set color and brightness setting - without the need of adjusting/transition…

I found this on reddit, but don’t fully understand what the guy is saying (I’m not a programmer…just a stupid end-consumer :smiley: ):

I just tested this by sending raw text commands to the bridge and seeing what happens. (My bridge
is gen1)
If I sent only the command to change color and nothing else while the lamp was off, the color setting in the bridge did not change.
If I sent “on: false” and the color change while the lamp was already off, it’s the same thing: values did not change.
It’s only when I sent a command containing “on: true” and color change, when it actually took on that color.
Conclusion: Settings will only get logged to the bridge when either A) the lamp is already on or B) the lamp is being switched on by the same command that contains new color instructions.
However, I tested sending a command that contained “on: false” and color instructions, and this stored new command settings to the lamp so next time it would be switched on, it would come on with those settings. So if you always want the lamp to switch on in white when you turn it on, a workaround could be to create a special off action that doesn’t just send “on: false” but also a white setting so the lamp “turns off into white”. I don’t think apps will let you do that because they’re incredibly limited, but you can hand-craft all of this by getting to know the Official Hue API and creating that setting from there. It’s not like it has to be done many times.

I would like to have some lights to not adjust the brightness, can anyone show me what a working configuration file would look like?

Here’s what I have so far:

switch:
  - platform: circadian_lighting
    lights_ct:
      - light.window_light_level_light_color_on_off
      - light.bedroom1_level_light_color_on_off
      - light.bedroom2_level_light_color_on_off
      - light.bedroom3_level_light_color_on_off
      - light.osram_lightify_flex_rgbw_fad4a400_level_light_color_on_off

I would like that only light.osram_lightify_flex_rgbw_fad4a400_level_light_color_on_off
wouldn’t update the brightness.

How can I do that? Thanks to everyone

What i make from this is when he sends an off command to the light with a specific color like you would normally when turning on the light the color inserted gets saved.

The light saves the last stored value.

This also isn’t an option because the values of the brightness and color changes during the day with AL/ Circadian lighting. So saving the current setting now and turn on the light 10 minutes from now will still get the light to change visible.

You can define the lights in: lights_brightness

Check out advanced configuration in the docs.

I have noticed the tag lights_brightness but I want it to affect only one light