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

Feedback-Loop with brightness sensor

Open RubenKelevra opened this issue 4 years ago • 3 comments

It would be nice if the adaptive lighting could take a brightness sensor into account.

Placed correctly it should be possible to dim the lights automatically based on the natural lighting shining in via the windows while automatically add lighting if necessary to maintain good lighting over the day, for example in a storm/rainshower or when it gets dark early in winter.

RubenKelevra avatar May 24 '21 02:05 RubenKelevra

This function is very lacking, you have to come up with your own crutches.

vring0 avatar Aug 01 '21 18:08 vring0

Any news?

vring0 avatar Nov 28 '21 20:11 vring0

@vring0

I'm currently in the process of doing version 2. This will be added/fixed.

RubenKelevra avatar Jan 08 '22 01:01 RubenKelevra

This is essentially the same request as https://github.com/basnijholt/adaptive-lighting/issues/578.

Copying my response from there:

This can be implemented using a simple automation.

Just use the adaptive_lighting.change_switch_settings ( https://github.com/basnijholt/adaptive-lighting#adaptive_lightingchange_switch_settings) and adjust your max_color_temp accordingly.

You can utilize a linear equation to adjust the max_brightness continuously based on the brightness sensor's reading. Here's a sample automation that linearly scales the max_brightness based on the readings of the sensor.brightness:

automation:
  - alias: "Adjust Adaptive Lighting Brightness based on Brightness Sensor"
    trigger:
      platform: state
      entity_id: sensor.brightness
    action:
      - service: adaptive_lighting.change_switch_settings
        data_template:
          max_brightness: >
            {% set sensor_val = states('sensor.brightness')|int %}
            {% set max_brightness = 100 - sensor_val %}
            {{ [1, max_brightness, 100]|sort()[1] }}

Explanation:

  • The automation triggers every time the state of sensor.brightness changes.
  • The linear equation used is ( \text{max_brightness} = 100 - \text{sensor_value} ). This means when the brightness sensor reads a value of 0, the maximum brightness will be 100, and when the brightness sensor reads a value of 100, the maximum brightness will be 0.
  • The template at the end ensures that the value stays between 1 and 100.

You can adjust the linear equation to better suit your needs.

Will close this issue because a solution exists. Thanks for your suggestion though!

basnijholt avatar Aug 06 '23 21:08 basnijholt