Lighting Level Formula

lights
automation

#21

Thanks! That’s basically what I had cobbled together.

{@mathApi}’(sin((pi%2F2)*cos((‘sum($hour24,format(‘%.2f’,$minute/60.0))’%2F3.88)%2B2.8))*45%2B55)’

Just a thought? How does this handle daylight savings time change? Is the light level and saturation off considering twice a year time is off by an hour from the days prior to the change?


#22

That should be handled automatically as the time of sunset / sunrise will also change time. This doesn’t match the position of the sun exactly, though I imagine you could work that in.


#23

Any chance you could share this piston?


#24

Sure:


#25

For what it’s worth, I have a pretty complicated piston that uses a parabolic formula “y=-2.3(x-0.34)^2+1” to control my Light Level and formula “y=-4.3(x-0.5)^2+1” to control my Color Temperature. Graphs here (Red is Temperature, Green is Level). They both go from 0 to 1 on both the X and Y axis, so it’s easy to convert their value to a percentage. I set a minimum value for Level/Temp, set a max value for Level/Temp, and as the day progresses (e.g. 25% of time has passed between Start and End), the Y axis corresponds to the percentage of the difference between Min and Max Level/Temp.
I tested a bunch of iterations, but this was the most natural combination of light level and temperature for me.
I can choose my start and end times for both graphs relative to sunrise or sunset, or time. I also have an external piston that will modify the Color Temp max and Light Level based off of Lux levels in the current local weather.

If you can make sense of it, here’s my piston;