Skip to content

Add light color state (#1)#39

Merged
lawtancool merged 3 commits intolawtancool:masterfrom
gecko2308:master
Feb 3, 2026
Merged

Add light color state (#1)#39
lawtancool merged 3 commits intolawtancool:masterfrom
gecko2308:master

Conversation

@gecko2308
Copy link
Contributor

  • update with async

  • method to set color

  • update websocket

  • update version

gecko2308 and others added 3 commits August 28, 2025 21:16
* update with async

* ajustement

* method to set color

* update version

* update websocket

* comment adjustment

* comment adjustment

* update version
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)
Copy link
Owner

@lawtancool lawtancool Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all MODIFIED words from comments (leftovers from AI?)

import aiohttp

ip = "192.168.1.25"
ip = "192.168.2.40"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all changes to test.py

@lawtancool lawtancool merged commit 0c549f9 into lawtancool:master Feb 3, 2026
4 checks passed
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.

2 participants