Add light color state (#1)#39
Merged
lawtancool merged 3 commits intolawtancool:masterfrom Feb 3, 2026
Merged
Conversation
* update with async * ajustement * method to set color * update version * update websocket * comment adjustment * comment adjustment * update version
lawtancool
requested changes
Jan 17, 2026
Comment on lines
+70
to
+83
| async def setColorRGB(self, r: int, g: int, b: int, *, rate: int | None = None): | ||
| """RGB 0..255 -> xy, mode=0 (full color).""" | ||
| x, y = self._rgb_to_xy(r, g, b) | ||
| await self.setColorXY(x, y, rate=rate, mode=0) | ||
|
|
||
| async def setColorHex(self, hex_color: str, *, rate: int | None = None): | ||
| """HEX (#RRGGBB/#RGB/RRGGBB/RGB) -> xy, mode=0 (full color).""" | ||
| r, g, b = self._hex_to_rgb(hex_color) | ||
| await self.setColorRGB(r, g, b, rate=rate) | ||
|
|
||
| async def setColorTemperature(self, kelvin: int, *, rate: int | None = None): | ||
| """Kelvin -> xy, mode=1 (CCT).""" | ||
| x, y = self._cct_to_xy(kelvin) | ||
| await self.setColorXY(x, y, rate=rate, mode=1) |
Owner
There was a problem hiding this comment.
If Control4 only supports XY color, we should not try to implement our own color conversions for RGB, hex, CCT, etc. inside the pyControl4 library. Color conversion should be left to the clients (like Home Assistant). Please remove all the extra color utils as well.
|
|
||
| def remove_item_callback(self, item_id, callback=None): | ||
| """Unregister callback(s) for an item. | ||
| MODIFIED: Supports selective or complete removal. |
Owner
There was a problem hiding this comment.
Please remove all MODIFIED words from comments (leftovers from AI?)
| import aiohttp | ||
|
|
||
| ip = "192.168.1.25" | ||
| ip = "192.168.2.40" |
Owner
There was a problem hiding this comment.
Please remove all changes to test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
update with async
method to set color
update websocket
update version