Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling CT and brightness adjustment individually #4

Open
claytonjn opened this issue Apr 4, 2019 · 9 comments
Open

Allow disabling CT and brightness adjustment individually #4

claytonjn opened this issue Apr 4, 2019 · 9 comments
Labels
enhancement New feature or request

Comments

@claytonjn
Copy link
Owner

claytonjn commented Apr 4, 2019

Currently, if a CL switch is configured to adjust both color temperature and brightness, the CL toggle switch and the disable_state disables all adjustment (both color temperature and brightness). It would be nice to be able to dynamically enable/disable just color temperature or brightness - for example, you may want the option to turn brightness up for certain tasks while still maintaining the proper color temperature.

This can technically be accomplished already by configuring a "color temperature" CL switch (with disable_brightness_adjust set to true) and a "brightness" CL switch (with lights included under lights_brightness). While this works, it doubles the amount of service calls when both are on.

The ideal solution should be to create a new type of entity (i.e. cl_group) with two toggles (color temperature and brightness), if both are configured. This would also mean creating a custom entity-row for Lovelace.

@claytonjn claytonjn added the enhancement New feature or request label Apr 4, 2019
@claytonjn
Copy link
Owner Author

Thinking about something like this for entity-row:
cl_group rendering

@DaAwesomeP
Copy link

This would allow for using automation to slowly bring up the brightness of the lights in the morning as a "circadian alarm clock" while maintaining the correct color temperature (though I suppose that would also require knowing what the intended brightness at that time should be).

@claytonjn
Copy link
Owner Author

This would allow for using automation to slowly bring up the brightness of the lights in the morning

This already happens; lights will brighten from solar midnight (when Sun is at the lowest point below the horizon) to sunrise. The problem is that people associate sunrise as the start of the sunrise when in reality it is when the sun is already above the horizon.

@DaAwesomeP
Copy link

No I mean applying a separate user controlled brightness like an actual alarm clock. For example, I could set a wake up time and have the lights slowly dim up to the current circadian level and temperature over 20 minutes. I think there are some commercial clocks/lights that do this.

@claytonjn
Copy link
Owner Author

Oh, gotcha - you mean you need to know what the proper brightness for the end of the ramp-up time would be.

I use Sleep as Android as an alarm clock and it directly pairs to my Hue bridge to brighten my nightstand lamp with my alarm. It also ties in with Tasker which I have connected to Home Assistant. So basically; when the house is in "sleep" mode I turn off Circadian Lighting for the bedroom lights, when the alarm clock goes off it slowly brightens my nightstand lamp, when I dismiss my alarm Home Assistant leaves "sleep" mode and Circadian Lighting is turned on for the bedroom lights, adjusting them to the proper settings.

@DaAwesomeP
Copy link

Haha yeah that's exactly what I'm trying to do (except 100% in Home Assistant). I would need to know the brightness to ramp to as well as be able to disable only brightness automatic control (but not color temp). I guess the brightness could be included in the sensor that show the current color temps.

@avdz
Copy link

avdz commented Nov 14, 2019

Haha yeah that's exactly what I'm trying to do (except 100% in Home Assistant). I would need to know the brightness to ramp to as well as be able to disable only brightness automatic control (but not color temp). I guess the brightness could be included in the sensor that show the current color temps.

I think you can achieve this in HA by disabling the switch and using the circadian values as setpoints for your lights. I'm not sure if they are updated when CL is switched off. But you can try to solve this by having a virtual (and possibly hidden) CL switch for your setpoints.

I would be interested to know if this approach works.

@DaAwesomeP
Copy link

This is what I am currently doing, but it is a bit unintuitive, and it has a few undebugged issues, but it works most of the time:

#
# Wakeup Lights, with circadian
#
- alias: bedroom_wakeup_lights_circadian_start
  trigger:
    - entity_id: binary_sensor.bedroom_waking_up
      platform: state
      to: 'on'
  condition:
  action:
    - service: homeassistant.turn_on
      data:
        entity_id: input_boolean.bedroom_circadian_disable
    - service: homeassistant.turn_off
      data:
        entity_id: input_boolean.bedroom_circadian_sleep
    - service: light.turn_on
      data_template:
        entity_id: light.bedroom_overhead_lights
        brightness_pct: >
          {% if state_attr('switch.circadian_lighting_bedroom_circadian_lighting', 'brightness') > 0 %}
            {{ state_attr('switch.circadian_lighting_bedroom_circadian_lighting', 'brightness') | int }}
          {% else %}
            100
          {% endif %}
        transition: 1200
        kelvin: "{{ state_attr('sensor.circadian_values', 'colortemp') | int }}"


#
# Wakeup Lights, off!
#
- alias: bedroom_wakeup_lights_circadian_end
  trigger:
    - entity_id: binary_sensor.bedroom_waking_up
      platform: state
      to: 'off'
  condition:
  action:
    - service: homeassistant.turn_off
      data:
        entity_id: input_boolean.bedroom_circadian_disable

The main issue I need to solve now is that if I leave the light in sleep mode and turn it off, it will not wakeup properly—I don't remember if it errors or just doesn't work, but I think this might be why I put the if statement in there (this was a while ago, so I don't remember).

@e2m32
Copy link

e2m32 commented Jan 10, 2021

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants