I’m trying to figure out the best method to implement dynamic light level changes of my house lights based on the readings from an outdoor light sensor and am hoping those with better brains may have some ideas…
I am currently gathering light level data reliably from outside and without light pollution from other sources. I now want to use this data to modify the brightness level of my lights in a couple of different ways.
firstly, when a light is initially turned on, I wish to cross reference the last reported lumen level, then run it through a formula to turn into a light brightness value. (percent or similar).
When a light is first turned ON, the brightness level will be set based on the result of the formula. so for example, turning on the lights when it is dark outside, I want the initial brightness level to be around 30%. (I’ll dial in the values later).
Rather than duplicate masses of code per light, I am wondering if there is a way I can write a common function which all lights could use to obtain the initial brightness value.
once I am happy I’ve got the above step working, I would like to build on it. When the light sensor changes values, evaluate the brightness level of lights which are currently ON, and dependig on the output of the formula, potentially modify the brightness level. I want to use helpers (boolean) to be able to turn on/off this feature per light as it may not always be desired.
I’ve no idea how to do the first step, where the value for brightness level is coming from some sort of service/function/formula. can anybody point me in the right direction? I think once I’ve got started I might be able to figure out the rest, but as always, step 1 is a challenge