Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Change color temp of bulbs with rotation? #186

Closed
pdawg17 opened this issue Nov 18, 2023 · 2 comments
Closed

Change color temp of bulbs with rotation? #186

pdawg17 opened this issue Nov 18, 2023 · 2 comments
Labels
Support Support issue. Nothing to do in code.

Comments

@pdawg17
Copy link

pdawg17 commented Nov 18, 2023

I am trying to adjust the color temp of my Hue bulbs with rotation but cannot get it working correctly. Is it possible? I may be interpreting how this plugin works but if I use "Kelvin", rotationAbsolute is only a number between 0 and 255 and rotationPercent is 0-100%, does it not work because Kelvin is a range of numbers that do not fit for these categories?

@cgiesche
Copy link
Owner

cgiesche commented Nov 18, 2023

With a bit of Math-Foo it works (for me with my hue lights):
Service Data for "Turn On" Service:

{% set min = 2200 %}
{% set max = 6535 %}
{
"kelvin": {{ min + rotationAbsolute * ((max - min) / 255) }}
}

min = Minimum color temp supported by bulb
max = Maximum color temp supported by bulb

You can validate all values and the outcome with custom labels:



{{min_color_temp_kelvin}}-{{max_color_temp_kelvin}}
{{color_temp_kelvin}}

grafik


Bonus:
You can create nice "bright cold to dim warm" effects, too:

{% set min = 2200 %}
{% set max = 4000 %}
{
"kelvin": {{ min + rotationAbsolute * ((max - min) / 255) }},
"brightness": {{ rotationAbsolute }}
}

@cgiesche cgiesche added the Support Support issue. Nothing to do in code. label Nov 18, 2023
@pdawg17
Copy link
Author

pdawg17 commented Nov 19, 2023

With a bit of Math-Foo it works (for me with my hue lights): Service Data for "Turn On" Service:

{% set min = 2200 %}
{% set max = 6535 %}
{
"kelvin": {{ min + rotationAbsolute * ((max - min) / 255) }}
}

min = Minimum color temp supported by bulb max = Maximum color temp supported by bulb

You can validate all values and the outcome with custom labels:



{{min_color_temp_kelvin}}-{{max_color_temp_kelvin}}
{{color_temp_kelvin}}

grafik

Bonus: You can create nice "bright cold to dim warm" effects, too:

{% set min = 2200 %}
{% set max = 4000 %}
{
"kelvin": {{ min + rotationAbsolute * ((max - min) / 255) }},
"brightness": {{ rotationAbsolute }}
}

WOW! Thank you! Works great! That's way above my Math-Foo level...

Repository owner locked and limited conversation to collaborators Dec 10, 2023
@cgiesche cgiesche converted this issue into discussion #209 Dec 10, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Support Support issue. Nothing to do in code.
Projects
None yet
Development

No branches or pull requests

2 participants