question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: circadian light entities

See original GitHub issue

Instead of having separate switches for circadian lighting and the actual light, I like to create template lights that transparently include circadian lighting. My implementation looks like this:

switch:
  - platform: circadian_lighting
    name: Office
    lights_ct:
      - light.office_light

light:
  - platform: template
    lights:
      circadian_office_light:
        friendly_name: Circadian Office Light
        level_template: "{{ state_attr('switch.circadian_lighting_office', 'brightness') | int }}"
        value_template: "{{ states('light.office_light') }}"
        turn_on:
          service: script.circadian_lighting_office_turn_on
        turn_off:
          service: homeassistant.turn_off
          data:
            entity_id:
              - switch.circadian_lighting_office
              - light.office_light

script:
  circadian_lighting_office_turn_on:
    sequence:
      - service: homeassistant.turn_on
        data:
          entity_id: switch.circadian_lighting_office
      - service: homeassistant.turn_on
        data_template:
          entity_id: light.office_light
          kelvin: "{{ state_attr('sensor.circadian_values', 'colortemp') | int }}"
          brightness_pct: "{{ state_attr('switch.circadian_lighting_office', 'brightness') | int }}"

This solves multiple issues, most importantly it will guarantee that the lights come on in the correct state and that they can be turned off properly. It also makes it easier to include them in automations, groups, or whatever else people usually want to do with their lights.

The example above could probably be improved a little by making the turn_on script more generic, however it is still quite cumbersome to define these entities for every light. So I was thinking, would you be interested in adding something like this to the component?

It would be even greater if the virtual light would disable circadian lighting when colortemp or brightness have been set explicitly, until the light is turned off again.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
phhacommented, Nov 27, 2019

Thinking about it, my dream would be to have a light entity that exposes all the attributes of the actual light like brightness, rgb_color, etc plus an additional attribute circadian: true|false, so you could do something like this:

service: light.turn_on
data:
  circadian: true

Thinking about it some more, it would be great if the component could auto-detect whether the underlying light supports rgb, color_temp, xy, … and automatically pick the best option.

Thinking about it super much, if all of the above is possible, you could simply add the circadian attribute to all lights with a one central config entry. Circadian lighting would be just another feature of all lights, in addition to the features they have out of the box.

I’m just getting started with Home Assistant, so I have no idea how feasible this is.

0reactions
cooljimy84commented, Apr 24, 2020

Shame, but I’m sure they have a road map to try and stick to as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Ultimate Guide to Circadian Lighting - Tetra Tech
Light is one of the biggest influences on circadian rhythm: A chart that explains the way eyes process light and send messages to...
Read more >
Recommendations for daytime, evening, and nighttime ... - PLOS
Light exposure influences human health and wellbeing by modulating circadian rhythms and sleep. This Consensus View outlines the first ...
Read more >
Circadian Lighting [Custom Component]
Circadian Lighting has two main components, a sensor and switch(es). The sensor maintains the calculated color temperature to keep all lights in ...
Read more >
Circadian Light For Your Health - GSA.gov
GSA's research has been focused on identifying the links between the amount of light people receive at work and their wake/sleep patterns, daytime...
Read more >
Age of Enlightenment: The Promise of Circadian Lighting
The use of tunable, circadian lighting is spreading — even though the science of what really works is ongoing. Here ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found