lsismeiro / awesome-ha-blueprints

A curated collection of automation blueprints for Home Assistant.
https://epmatt.github.io/awesome-ha-blueprints
GNU General Public License v3.0
78 stars 16 forks source link

Add Clamping of Color Temperature to Light Blueprint #15

Closed botastic closed 3 months ago

botastic commented 4 months ago

Thank you for taking the time to work on a Pull Request. Your contribution is really appreciated! :tada: Please don't delete any part of the template, since keeping the provided structure will help maintainers to review your work more rapidly.

Sections marked as * are required and need to be filled in.

Proposed change*

In its current version the light hook allows the color temperature to be changed to values that are not support by the light bulbs. Reaching values far outside this range will require the user to press the opposite button, potentially overshooting in the other direction.

I added a clamping mechanism similar to the brightness minimum and maximum. Additionally, I added a feature toggle that is deactivated by default, in order to prevent any breaking changes.

I had a look at a couple of example light bulbs, here are their valid color temperature ranges:

Checklist*

NOTE: I did not commit the result of formatting, because it changed quit a lot of files. Either my formatting is not setup correctly or the code has not been formatted recently. However, none of my changes were changed by formatting :)

LewisSpring commented 3 months ago

Hi, sorry I forgot about this!

Don't worry about the formatting, I don't bother with it for the same reason.

Let me test this and I'll merge if all good.

LewisSpring commented 3 months ago

Looks good to me, I'm happy to merge but wanted to check you tested this long term with no issues?

botastic commented 3 months ago

Hey, no worries, I was also a bit busy.

I have my fork running since I created the PR and I'm using the feature with the Innr RB 279 T bulbs together with an IKEA E1810 - no issues so far. I also checked the clamping once more and it is still working.

Also thank you very much for maintaining this fork and being open to PRs!

LewisSpring commented 3 months ago

Thanks! Merged. Will send out a message to the Redux threads when I get a moment