Circadian Lighting [Custom Component]

This is not a bug, it is done intentionally. The reason there are multiple switches is that you can define different behavior for different sets of lights - therefore, brightness may not be the same for all lights and it can’t be in the single sensor. Color temperature on, the other hand, is in the sensor because the whole point of this component is that all lights match color temperature and therefore it should be the same for all lights.

1 Like

OOOHhhh it actually just clicked in my mind and this choice does makes sense to me :slight_smile:

just FYI my use case : i use one of my bedroom lamps as a wake up light (turns on red at 1 % and over 30 min goes slowly to a warm temp at 100%)
with a circadian switch for the whole house and applied on my hue group “bedroom” it has the effect to turn on all my 3 bedrooms lamps directly at 100% when my wakeup light turns on.

fix i’m gonna try : set a dedicated circadian switch for my bedroom which is disabled by my wakeup automation during 30 mins

Not sure if this is intentional or that I am doing something wrong. I just started and the logs are telling me that Circadian Lighting is off and will not do any adjusting:

2018-12-07 17:27:23 DEBUG (Thread-3) [custom_components.circadian_lighting] Circadian Lighting Component Updated
2018-12-07 17:27:23 DEBUG (Thread-16) [custom_components.switch.circadian_lighting] Circadian Lighting Switch Updated
2018-12-07 17:27:23 DEBUG (Thread-8) [custom_components.sensor.circadian_lighting] Circadian Lighting Sensor Updated
2018-12-07 17:27:23 DEBUG (Thread-16) [custom_components.switch.circadian_lighting] Circadian Lighting off - not adjusting

I do not understand why is it off?
my config:

circadian_lighting:
  max_colortemp: 5500
  min_colortemp: 2200
  interval: 300
  transition: 300

switch: !include_dir_merge_list switch/

switch file:

- platform: circadian_lighting
  lights_ct:
    - light.eetkamer_tafel
    - light.koof
    - light.hal_0

So I have 3 lights now on, but all cold white and I am expecting it to be set to warm as it is evening now (Circadian Values = -24)

There is an actual switch entity created. Is it off? If you’re using Lovelace or have the older default view configured you’ll have to go into the States page to see the entity.

Yes switch was off, thanks!
I have added it to one of my groups and switched it on. Now it is working.

This is a valid assumption for singles/couples but when there are more family members around, maybe each room needs its own circadian curve.

For example, teenagers and elderly folk have very different needs from the component. Teenagers need their own sunrise/sunset offsets and the elderly need different color temperature range.

Might be a good enhancement to move color temperature to the switch, if you ask me.

Hello all, @claytonjn

Please, in my automations, I changed my light scene selection from input_select to input number.

input_number:
   nb_lampes_entree:
        name: Entrée Off/Nuit/Etabli/Tout
        min: 0
        max: 3
        step: 1

(I don’t know how to get integer there, my automations are like : is_state('input_number.nb_lampes_entree','3.0') )

Then, I would like to know if for circadian switches, this is the good syntax:

switch:
  - platform: circadian_lighting
    lights_ct:
      - light.lampe_etabli_entree # Lampe établi entrée
      - light.lampe_mur_entree # Lampe mur entrée
      - light.lampe_escalier_entree # Lampe escalier entrée
    min_brightness: 50
    sleep_entity: 'input_number.nb_lampes_entree'
    sleep_state: '1.0'
    sleep_brightness: 1
    name: Luminothérapie Entrée

It does not seems I have a brightness of 1 when the input number is 1.0.

Thank you for your help

Is there any chance of having this added to the HA (maybe replacing built in flux)?

I have same problem with Yeelight ceiling lights as well as with Flux.

2018-12-11 18:34:33 ERROR (SyncWorker_9) [homeassistant.components.light.yeelight] Error when calling <function YeelightLight.set_colortemp at 0x7fde4f08ebf8>: {'code': -5000, 'message': 'general error'}

2018-12-11 18:34:33 ERROR (SyncWorker_5) [homeassistant.components.light.yeelight] Error when calling <function YeelightLight.set_colortemp at 0x7fde4f08ebf8>: {'code': -5000, 'message': 'general error'}

I will really have to think deeply about this. I understand your examples, but even in that case unless people are isolated into one room then they would be going in and out of different, shared, areas (kitchen, bathroom, etc.) and having different color in different areas would completely defeat the point of maintaining a controlled circadian rhythm.

At first glance your configuration looks correct. Could you try enabling debug logging for Circadian Lighting and send me the logs for when the input select is set to 1?

Here’s the configuration.yaml for logging:

logger:
  logs:
    custom_components.circadian_lighting: debug
    custom_components.sensor.circadian_lighting: debug
    custom_components.switch.circadian_lighting: debug
1 Like

I’m open to it, but flux is still in active development so I’m not sure it would replace it. I just need to figure out who to talk to about it!

Is the issue only when you configure them as lights_ct (have you tried lights_rgb or lights_xy)?

On GitHub you mention you can adjust color temperature in the frontend - are you referring to the slider on the light or with the light.turn_on service call?

I tried lights_xy → nothing happens.

are you referring to the slider on the light or with the light.turn_on service call?

I tried slider, but as you wrote I tried service call too:

{
  "color_temp": "370",
  "entity_id": "light.yeelight_ceiling_7c49ebb38056"
}

…and it’s working. I am confused now. If color temp changing works from service call, slider, then why not from plugins?

Do you have CL configured to adjust brightness? Try a service call that also adjusts brightness and transition, like this:

{
  "entity_id": "light.yeelight_ceiling_7c49ebb38056",
  "color_temp": 370,
  "brightness": 50,
  "transition": 900
}

I can confirm, this works too.

Plugins like Flux/CL are changing color_temp differently? I can’t imagine then why it’s working manually and not trough the plugin.

Not as far as I know, no. I’m curious if it starts working after 0.84 - there were some behind-the-scenes changes to service calls in automations and scripts and I’m not sure if that would affect components.

Just discovered something about Home Assistant 0.84.0. doesn’t like the switch component… captured the error, rolled back to 0.83.3 and the switch is working again. Let me know if there’s anything I can do to help get it working correctly with 0.84.0

2018-12-12 12:13:08 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.switch.circadian_lighting. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 92, in get_component
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/switch/circadian_lighting.py", line 16, in <module>
    from homeassistant.helpers.restore_state import async_get_last_state
ImportError: cannot import name 'async_get_last_state'
2018-12-12 12:13:08 ERROR (MainThread) [homeassistant.loader] Unable to find component switch.circadian_lighting
2018-12-12 10:13:20 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.switch.circadian_lighting. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/loader.py", line 92, in get_component
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/switch/circadian_lighting.py", line 16, in <module>
    from homeassistant.helpers.restore_state import async_get_last_state
ImportError: cannot import name 'async_get_last_state'

Same problem here.

Thanks for the logs, looks like something changed with state restore in 0.84. Looking into it now and hopefully will have a version for you guys to try out soon.

1 Like