Circadian Lighting [Custom Component]

1 Like

Thanks so much @claytonjn for a great component!

  • I am using Hue lights that show the color temp in mireds. Can I just convert this into Kelvin?

The 0.92 update broke this component for me. Anybody know how to fix it? I think itā€™s because of the new way custom components work with hassio.

1000000/mired=kelvin

1 Like

It seems that for some people a manifest.json is required. Itā€™s on my to-do list, but itā€™s weird - manifest.json is supposed to be optional at this point and CL (and all other custom components) work fine for me on 0.92.0 and 0.92.1.

Out of curiosity, how are you running HA? There must be some variation thatā€™s causing manifest.json to be required for some people and not othersā€¦

Out of curiosity, how are you running HA?

I am running Hassio on RPI3B+

And I saw that you are working on the new integration on the Circadian Lighting GitHub page. Thank you, very cool.

For now you could test this manifest.json in custom_components\circadian_lighting:

{
  "domain": "circadian_lighting",
  "name": "Circadian Lighting",
  "documentation": "https://github.com/claytonjn/hass-circadian_lighting",
  "dependencies": [],
  "codeowners": ["@claytonjn"],
  "requirements": []
}

I was running a CL version released in January and have updated to the lastest version and added the manifest.json file. It works again!

1 Like

Hello @claytonjn, thanks but I donā€™t quite get it. 154 Mireds correspond to 6500 K, 450 to 2200K. But 154 Mireds is very cold light and 6500 K very warm? What am I getting wrong? Thanks!

6500K is very cool white and 2200K is very warm white (I know, not intuitive). Here is a random (but accurate) chart I found online: https://www.directtradesupplies.co.uk/blog/wp-content/uploads/2015/07/kelvin-chart.jpg

1 Like

Ah, I was coming from my Lightroom Development panel where the White Balance is exactly the opposite. I thought that scale was in Kelvin but I guess I am wrong.

Iā€™ve been using this for a while now and Iā€™m trying to solve a problem with the brightness level in the morning. Throughout the day, the lights slowly dim and the colors change appropriately, with a nice warm glow in the late evening. However in the early morning hours, the lights are very very bright.

Iā€™m using very vanilla configurations, this is my kitchen:

  • platform: circadian_lighting
    name: kitchen_circadian
    lights_ct:
    • light.kitchen

For example, this morning I woke up early and itā€™s still dark outside. However when I walked into the kitchen, the lights turned on and were way to bright.

Here are my switch attributes from this morning:

lights_ct: light.kitchen
lights_rgb: null
lights_xy: null
lights_brightness: null
disable_brightness_adjust: false
min_brightness: 1
max_brightness: 100
sleep_entity: null
sleep_state: null
sleep_colortemp: null
sleep_brightness: null
disable_entity: null
disable_state: null
hs_color: 28.681,71.373
brightness: 84.69367187499999
friendly_name: kitchen_circadian
icon: mdi:theme-light-dark

These are Hue gu10 bulbs (non-color). Iā€™m using an identical setup in other rooms with color Hue bulbs and seeing the same results. My long/lat is set correct in HA and the sun component appears to be working like normal.

Iā€™m using Node Red for my automations and Iā€™m simply just turning on light.kitchen and making sure the circadian switch is also turned on. This does normally cause a brightness ā€œjumpā€ if theyā€™ve been off for a while, and I want to start using the kelvin values of the sensor to turn them on more appropriately. However this blinding-mornings problem is not related to this, because the lights start dim and go to very bright and stay there.

Any suggestions?

I wrote the logic in CL to mimic natural light as closely as possible. It adjusts color temperature throughout the day and brightness throughout the night, but during the day brightness is always max_brightness and during night color temperature is always min_colortemp. I did this because once the sun rises the color temperature changes based on the angle and refraction of light through the atmosphere, but the brightness of the sun doesnā€™t really change (excepting for weather conditions which I donā€™t want to account for because it throws off the consistency).

All that being said, it looks like CL is working as expected. One issue is that one could have the exact same setup for two groups of lights, one with just 2 lights and one with 20. Obviously the setup with 20 lights will out out more light at the same brightness percentage than the one with 2 lights. Thereā€™s no way for me to really program for this, itā€™s really a matter of proper lighting design.

You have a few options to adjust the behavior to better meet your needs. What I do is turn off CL for my bedroom lights in my ā€œsleeping routineā€, and the alarm app on my phone is tied in with my Hue lights and slowly brightens the lights with the alarm. Then once I dismiss my alarm my ā€œhome routineā€ runs and turns on CL for the bedroom, bringing the lights up to 100%. I plan on adding the ability to toggle brightness adjustment or colortemp adjustment independently for any CL ā€œgroupā€, but in the mean time you could set up your lights in two CL switches - one with disable_brightness_adjust set to true and the other with the lights listed under lights_brightness. That essentially does the same thing, allowing you to turn on/off brightness and colortemp adjustment independently. At that point youā€™d need to either play with the CL offsets or do something else to get the brightness to adjust the way you want.

1 Like

My heart leaped when reading this. Iā€™d like to suggest including the colortemp in the attributes of a CL switch entity and even updating the attributes while the switch is off. This would make complex automations & setups way easier to implement.

I could include colortemp in the attributes of each switch fairly easily, although really itā€™s just more overhead for HA without any benefit. Could you explain a specific circumstance where having colortemp in the switches is necessary?

Thereā€™s nothing in CL telling it not to update attributes when the switch is off, HA simply doesnā€™t update it. If I end up creating a new type of entity such as cl_group. instead of switch. then it may be possible.

Sure! With my setup right now Iā€™m seeing a fast color transition and two calls to light.turn_on when the lights get turned on after they havenā€™t been used for a while. Having brightness & color temperature conveniently available in automations would allow me to turn the light on without this transition.

Could be also useful for integrating stuff outside of ambient lighting. My projector for example has an HTTP API and color temperature setting. But I havenā€™t really looked into it yet.

Yesterday I tried to get a pull request with my suggested changs and gave up waaay too fast thanks to my limited programming knowledge. Good to know my time would have been wasted anyway :slight_smile:

They are both available - this is a python_script, but the same idea would apply for an automation:

hass.services.call('homeassistant', 'turn_on', { "entity_id" : "light.master_bathroom_recessed_lights" , "kelvin" : int(float(hass.states.get('sensor.circadian_values').attributes['colortemp'])) , "brightness_pct" : hass.states.get('switch.circadian_lighting_master_bathroom_circadian_lighting').attributes['brightness'] })

Of course! I havenā€™t checked the sensor entity. Makes sense. Sorry for the noise. :crazy_face:

I love CL and it works just fine.

However, I get two error messages which may be irrelevant but I just wanted to check:

2019-05-03 08:09:59 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for circadian_lighting which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-05-03 08:10:11 WARNING (MainThread) [homeassistant.helpers.service] Unable to find services.yaml for the circadian_lighting integration

@claytonjn @sapnho I get also Unable to find services.yml for the circadian lighting integration, have added all 3 files and manifest.json

EDIT: Have fixed it with empty file services.yaml in circadian_lightning folder

I have Hue zigbee, Zipato zwave and Muller Tint zigbee lights, but have only problems now with Muller Tint lights, because I had before in automation and switch in floorplan hue activate scene service(https://github.com/home-assistant/home-assistant/issues/20638), but now with light/homeassistant.turn_on the lights blink, any way to call scene or somehow to stop blink/flickering when I call light/homeassistant.turn_on

1 Like