21.09.2023, 15:08
(21.09.2023, 14:45)admin Wrote: Should be something like this:
Code:br = grp.getvalue('1/5/10')
ct = grp.getvalue('1/0/14')
ww = (100 - ct) * br / 100 -- warm white value (0..100%)
cw = ct * br / 100 -- cold white value (0..100%)
grp.write('32/6/1', cw)
grp.write('32/6/2', ww)
You need to attach the same script to both brightness and color temp value objects. grp.getvalue should be used because event.getvalue only returns the value of the object that triggered the event.
or can i run it as a resident script with 0 seconds?
If i would like to turn out the value of dali directly instead if in percent is it right like this (reference is colour temp in K so it also works with homekit)?
CW or WW Light is 1% = 85 and 100% = 254
Code:
br = grp.getvalue('1/5/10')
ct = grp.getvalue('1/0/14')
ww = ((100 - (ct - 2700) * 0.000263157894736842) * br / 100) * 169 + 85 -- warm white value (85..254)
cw = (((ct - 2700) * 0.000263157894736842) * br / 100) * 169 + 85 -- cold white value (85..254)
grp.write('32/6/1', cw)
grp.write('32/6/2', ww)