30.01.2022, 20:42
How do I get it out that I can change the color temperature by a percentage value, either via the absolute color temperature 7,600 or via a 4-bit dimming step 3,007
with this script.
Can someone help me, I'm a complete novice
with this script.
Can someone help me, I'm a complete novice
Code:
function setBrightnessCT(Light_num,brightness,ct)
if brightness == 0 then
body_msg = '{"on":false}'
response = sendToLight(lamp_id,body_msg)
return response
else
brightness = math.floor((brightness / 1) + 0.5)
brightness = math.floor((brightness * 2.54) + 0.5)
ct = math.floor(1000000 / ct)
ct = math.min(500, ct)
ct = math.max(154, ct)
--HTTP request send
body_msg = '{"on":true,"bri":'..brightness..',"ct":'..ct..'}'
return sendToLight(Light_num,body_msg)
end
end