Circadian Lighting [Custom Component]

Hey all, just wanted to let you know I’ve been reading all the posts and thinking about the issues with transitions. I haven’t had a lot of time to work on this but didn’t want you to think I’ve forgotten!

4 Likes

Hai there :slight_smile:

Just noticed something silly

the sensor component doesn’t return the brightness value !

Only value missing for some of my node-red automations :slight_smile:

Should be a really quick fix, right ?

Hi @pixeye33, I’m pretty sure that the current calculated brightness is an attribute on the switch, so you should be able to get it from there.

Hello,

Yes i know it’s on the switch :slight_smile: (and did that to wait for the fix)
but why can i get the rgb/xy value but not the brightness on the sensor component ?

i do believe that all the values calculated or set for circadian should be on the sensor component and should not be exposed as attributes on the switch.

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.