openhue / openhue-cli

OpenHue CLI is a command-line interface for interacting with Philips Hue smart lighting systems.
https://www.openhue.io/cli
Apache License 2.0
41 stars 6 forks source link

Set color temperature #44

Closed fabianostermann closed 5 months ago

fabianostermann commented 6 months ago

Hi,

thx for your cool project! Manipulating my IKEA Tradfri lightbulb with the client worked out of the box with a philips hue bridge.

This particular lightbulb, however, does not support color. Instead it "only" has a linear temperature (warm-cold / yellow-blue). So using the flag --color/--x/--y did not work. I saw that the API already has a temperature command implemented. My question: Is it planned to include into the client?

Thx in advance for any response!

thibauult commented 5 months ago

Hi @fabianostermann,

Thanks for opening this issue! According to the API specification:

Screenshot 2024-03-20 at 12 03 42

It is indeed possible to set the temperature in Mirek (value between 153 and 500). I could suggest adding a new temperature flag to the existing openhue light command, for example:

openhue set light --temperature 300

or the shorter version:

openhue set light -t 300

Would that work for you?

fabianostermann commented 5 months ago

Hi, thx for your answer!

That's exactly what I found in the API. I am quite sure this is the flag those bulbs with linear coloring need. Your proposals for new commands --temperate/-t are just perfect. I even had tried them out already on your last build as I couldn't believe they weren't there, since the API knows them. :smiley: So I think it would be a good improvement to the project (I hope you think the same!).

Thanks in advance for intergrating it!

thibauult commented 5 months ago

Hi @fabianostermann,

The latest 0.15 release now allows the set the color temperature in Mirek.

You can run the following commands to update OpenHue CLI:

brew update
brew upgrade openhue-cli

and try:

openhue set light YourLight --on -t 250

Please note that it also works with the openhue set room command

Please let me know if you have any feedback!

fabianostermann commented 5 months ago

Feedback is simple: Binary release build 0.15 is working flawlessly with my IKEA Tradfri bulbs controlled from my Ubuntu laptop!

Maybe one minor thought for discussion: The mirek value with min=153 and max=500 seems absolutely correct from the perspective of physical science, but for a user this is quite irrelevant and irritating (at least, if you do not want to have light art with exact colorings, but then you propably go with the RGB lights anyway). So it could be dicussed, if the mirek value shouldn't be normalized to [0,1] or [0,100] (like brightness), but for me its absolutely okay how it is now, as this is the specification and I as a programmer am able to implement my own convinience functions in my own scripts :+1:

Thanks again! :fireworks: