Lux Input mapped to Brightness Output

I’m trying to find the best way to have a light smoothly brighten and dim based on the ambient light in the room, based on specific input and output ranges. I have searched the forum but haven’t found quite what I’m looking for.

I created a basic flow which does a crude job of it, but lacks precision.

The basic formula I have started with is “1-(luminance *.36)”

My goal is to achieve something like this:

Input: 10-60 Lux
Output: 100-0% Brightness.

Does anyone know a way to map a specific input range to a specific output range so it tracks smoothly and predictably? Is there a math expression or app which would do the job?

Thank you!

The Chronograph app has cards explictly for transitions that might help.

Andy

(100-((Luminance-10)/(60-10))x100)%
When luminance = 10 the formula results in 100%
When luminance = 60 the formula results in 0%
When luminance = 35 the formula results in 50%

1 Like

Perfect! That is exactly the kind of solution I was looking for!

The original form wasn’t accepted by the Temporary Variables app, so I tweaked it to make it work. I changed the “x” to an asterisk, and also replaced the “%” with “*.01”. It works great now!

Thank you so very much for your help Rmb!!

1 Like

According to the name of the devices, it seems that the sensor and the lamp are in the same room, right?

So if the brightness in the living room changes, the brightness of the lamp is adjusted according to the formula. This changes the brightness in the living room again, which causes the brightness of the lamp to change again. And so on…
Doesn’t this lead to an infinite loop?

The sensor and the lamp are in the same room. However I set it up so that the sensor is pointed away from the lamp, so the sensor is looking at the general room brightness. The lamp is an accent lamp behind my TV, so the two don’t interact.

1 Like