Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting customizeable range for color temperature (mired scale) #12

Open
JorinL opened this issue Oct 17, 2022 · 4 comments
Open

Requesting customizeable range for color temperature (mired scale) #12

JorinL opened this issue Oct 17, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@JorinL
Copy link

JorinL commented Oct 17, 2022

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

@Christian-Me
Copy link
Owner

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.

@Christian-Me
Copy link
Owner

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.
image

I took a look but it seams that what you wish for is already implemented but in degrees kelvin:
image
resulting in this:
image
The only issue perhaps is that the result is not precisely hitting your targets:
image
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 irojs/iro-core#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.

@Christian-Me
Copy link
Owner

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

@JorinL
Copy link
Author

JorinL commented Oct 23, 2022

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

@Christian-Me Christian-Me added enhancement New feature or request question Further information is requested labels Oct 24, 2022
@Christian-Me Christian-Me self-assigned this Oct 24, 2022
@Christian-Me Christian-Me changed the title Requesting customizeable range for color temperature Requesting customizeable range for color temperature (mired scale) Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants