Help! Light brightness by lux level automation

Ignore what I said here. Seems I had come to this conclusion incorrectly.

1 Like

Hi Russel,
could you please explain logic after your code and numbers? it works great, but I’m trying to better understand what those numbers are (14000 and 76.5), to make thinks adapted to my number of installed lights :slight_smile:
I’m using it with 6 xiaomi lightbulbs on top, and xiaomi lightsensor on my desk. and when I add additional lightbulbs i get more lumens, say 1 lightbulb gives 47 lum with script (97 max), 5 gives 105 lumen, and 6 gives 116.

I’m in 60 square feet room with no windows and its not bright enought :slight_smile:

          brightness: >
            {%- set lux = states.sensor.lumi_lumi_sen_ill_mgl01_8dbf783c_illuminance.state | int -%}
            {%- set perc = (14000 - lux) / (14000 / 100) | int -%}
            {{ ((76.5 * perc) / 100) | int }}