This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Hue ledstrip with RGB and Tunable white
#9
(19.03.2019, 09:13)admin Wrote: Add to user library:
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

You will need to map an event script to both brightness and color temperature values:
Code:
require('user.hue)
lamp_id = 123
bri = grp.getvalue('1/1/1') -- 0..100%
ct = grp.getvalue('1/1/2') -- 2000K..6500K
setBrightnessCT(lamp_id, bri, ct)

Thank you very much :-)

Now it works like a charm:-)

Daniel
Reply


Messages In This Thread
RE: Hue ledstrip with RGB and Tunable white - by DanielB - 19.03.2019, 11:55

Forum Jump: