adaptive-lighting icon indicating copy to clipboard operation
adaptive-lighting copied to clipboard

Expose sensors indicating target brightness and temperature of AL set

Open jwvanderbeck opened this issue 3 years ago • 1 comments

This feature request is two parts:

  1. Allow AL to run calculations to determine target brightness and temperature of the set while switch switch.adaptive_lighting_x is off so that the lights don't get turned on by AL (this may already be the case, I include it for completeness)
  2. Create two sensors for each AL set, one that indicates the target brightness and one that indicates the target color temperature. Both values should be such that the value can be directly handed off to a light_on service call.

Why do I want this feature? Throughout my home lights get turned on and off throughout the day for reasons too many and too varied to go into. Currently when a light comes back on, it comes on at its last state and then you wait a period of time depending on settings until AL adjusts it. This works but since the lights going off and on again are controlled by HA in the first place, we can do better. With these sensors exposing the targets, those service calls that turn the lights on can do so with the exact correct AL settings without waiting for AL to update them.

Ancillary Benefits This feature could also have additional usefulness not immediately apparent. One that comes to mind for me, is you can use it to compare between target values and actual values helping to test lights and tweak settings. I have template sensors that track the SET values of brightness and color temp, but that only shows me what the light bulb is actually at not what AL wants it to be at, and for all I know they are different.

jwvanderbeck avatar Jul 10 '22 14:07 jwvanderbeck

I would love to be able to see the temperature of my lights.

spencerthayer avatar Jul 13 '22 16:07 spencerthayer

You could add the following to your configuration.yaml (change al1 to your Adaptive Lighting instance):

template:
  - sensor:
      - name: 'AL1 brightness'
        unit_of_measurement: "%"
        state: "{{ '%i'|format(state_attr('switch.adaptive_lighting_al1', 'brightness_pct')) }}"
        icon: mdi:brightness-6
  - sensor:
      - name: 'AL1 temperature'
        unit_of_measurement: K
        state: "{{ '%i'|format(state_attr('switch.adaptive_lighting_al1', 'color_temp_kelvin')) }}"
        icon: mdi:palette-outline

See https://www.home-assistant.io/integrations/template/ and https://github.com/basnijholt/adaptive-lighting/blob/master/custom_components/adaptive_lighting/switch.py for available attributes respectively.

peter--s avatar Oct 06 '22 10:10 peter--s

@peter--s has the right idea. Adaptive-lighting's main goal is to give users the ability to do everything they want to customize themselves in HASS, only when it's not possible to do so outside the integration do we usually consider these types of feature requests.

th3w1zard1 avatar Mar 23 '23 10:03 th3w1zard1