Open JorinL opened 1 year ago
I will have to take a look if what you wish for is supported by iro.js. If so it should be possible if not it will be more work to do. Pease don't expect immediate results. Sorry very busy these days.
Hi @JorinL .
first question do you mean 2500 - 4540k? because 250 in Kelvin makes no sense. Maybe your bulb expects the color temperature in mired (micro-reciprocal degrees, which is 1,000,000 divided by the color temperature in kelvins). https://developer.apple.com/documentation/homekit/hmcharacteristictypecolortemperature.
msg.payload = Math.floor(1000000/msg.payload)
return msg;
If so a simple function node might do the trick. and you don't need to read further.
I took a look but it seams that what you wish for is already implemented but in degrees kelvin:
resulting in this:
The only issue perhaps is that the result is not precisely hitting your targets:
This is because iro.js uses RGB as its internal base value. Transferring from and to color temperature is an iterative approximation process and comes with some Imperfektion. (you might take a look into this https://github.com/irojs/iro-core/pull/5).
The funny thing is that I myself don't use my own color picker node. I moved everything to apple homekit as my main UI as it is more family friendly as Opening a website.
But never mind, it might be that you are using an older version. I have not published the latest 0.1.7 to npm jet (as above issue is not merged). But you can pull the latest version 0.1.7 directly from GitHub if you like. This comes with a patched version of iro.js solving the 1000-2000k issue.
I googled a little bit and I think I guessed right.
So you have to calculate the min and max values in kelvin to set the limits correctly (2200 - 4000k) and convert the msg.payload to mired:
https://www.zigbee2mqtt.io/devices/LED1546G12.html
color_temp: To control the color temperature (in reciprocal megakelvin a.k.a. mired scale) publish a message to topic zigbee2mqtt/FRIENDLY_NAME/set with payload {"color_temp": VALUE} where VALUE is a number between 250 and 454, the higher the warmer the color. To read the color temperature send a message to zigbee2mqtt/FRIENDLY_NAME/get with payload
Hey Christian :-)
Thanks for the work.
The TRÅDFRI light bulb has 3 different white colours – warm white (2700 K), warm glow (2200 K) and cool white (4000 K). So lowest is 2700 and top is 4000 k. But in setting them you have the range 250 - 454.
I did not knowe, that this is a converted thing of the kelvin range :-)
Thanks I'll try. Did not know about mired :-) Thank you
Hey there really nice work - I like it a lot.
I use also IKEA floalt lamps. They have a color temperature range from 250 to 454 - I would enjoy to use the temperature slider for this. But is seems wide out of range ;-) Would be really cool if you can implement that - THX
Best regards! Jorin