Skip to content

Light: Invert set_color_temperature range check#126

Open
forderud wants to merge 1 commit intoLeggin:mainfrom
forderud:color-temp-fix
Open

Light: Invert set_color_temperature range check#126
forderud wants to merge 1 commit intoLeggin:mainfrom
forderud:color-temp-fix

Conversation

@forderud
Copy link

Fixes #125 by changing the logic, so that it fails if the temperature is outside the valid range instead of inside.

Fixes Leggin#125 by changing the logic, so that it fails if the temperature is _outside_ the valid range instead of _inside_.
@Leggin
Copy link
Owner

Leggin commented Jan 25, 2026

Wow crazy this didn't come up earlier, thank you!

@Leggin
Copy link
Owner

Leggin commented Jan 25, 2026

No wait a minute, at least my lamps all have as min 4000 and as max 2022
@forderud do you have other values?

@forderud
Copy link
Author

No wait a minute, at least my lamps all have as min 4000 and as max 2022
@forderud do you have other values?

This was very odd. I've so far only purchased an Ikea KAJPLATS E27 WS G60 lamp that reports color_temperature_min=153 and color_temperature_max=454. I therefore don't have any other device to compare against.

Could it be an idea to add logic for swapping min/max values to ensure that max is always greater than min? I'm thinking something along these lines...

if color_temperature_min > color_temperature_max:
    color_temperature_min, color_temperature_max = color_temperature_max, color_temperature_min # swap values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Light: Problems setting color temperature

2 participants