From c25a7bf92e7858f3adc878707ed08c0c2f941522 Mon Sep 17 00:00:00 2001 From: Suxsem Date: Thu, 20 Jun 2024 13:55:31 +0200 Subject: [PATCH 1/3] Add CCT support --- src/wled/models.py | 6 ++++++ src/wled/wled.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/wled/models.py b/src/wled/models.py index 3c3da212..22997aff 100644 --- a/src/wled/models.py +++ b/src/wled/models.py @@ -287,6 +287,12 @@ class Segment(BaseModel): from top-left corner of the matrix. """ + cct: int = field(default=0, metadata=field_options(alias="cct")) + """White spectrum color temperature. + + 0 indicates the warmest possible color temperature, + 255 indicates the coldest temperature + """ @dataclass(frozen=True, kw_only=True) class Leds: diff --git a/src/wled/wled.py b/src/wled/wled.py index 17c53584..1e442bc4 100644 --- a/src/wled/wled.py +++ b/src/wled/wled.py @@ -327,6 +327,7 @@ async def segment( # noqa: PLR0912, PLR0913 start: int | None = None, stop: int | None = None, transition: int | None = None, + cct: int | None = None, ) -> None: """Change state of a WLED Light segment. @@ -355,6 +356,7 @@ async def segment( # noqa: PLR0912, PLR0913 transition: Duration of the crossfade between different colors/brightness levels. One unit is 100ms, so a value of 4 results in a transition of 400ms. + cct: White spectrum color temperature. Raises: ------ @@ -383,6 +385,7 @@ async def segment( # noqa: PLR0912, PLR0913 "start": start, "stop": stop, "sx": speed, + "cct": cct, } # Find effect if it was based on a name From 66a6682aaab025e4bc38a0b4576bbc5a1155ac39 Mon Sep 17 00:00:00 2001 From: Suxsem Date: Thu, 20 Jun 2024 13:55:31 +0200 Subject: [PATCH 2/3] Add CCT support --- src/wled/models.py | 6 ++++++ src/wled/wled.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/wled/models.py b/src/wled/models.py index 008c9721..96266353 100644 --- a/src/wled/models.py +++ b/src/wled/models.py @@ -287,6 +287,12 @@ class Segment(BaseModel): from top-left corner of the matrix. """ + cct: int = field(default=0, metadata=field_options(alias="cct")) + """White spectrum color temperature. + + 0 indicates the warmest possible color temperature, + 255 indicates the coldest temperature + """ @dataclass(kw_only=True) class Leds: diff --git a/src/wled/wled.py b/src/wled/wled.py index 17c53584..1e442bc4 100644 --- a/src/wled/wled.py +++ b/src/wled/wled.py @@ -327,6 +327,7 @@ async def segment( # noqa: PLR0912, PLR0913 start: int | None = None, stop: int | None = None, transition: int | None = None, + cct: int | None = None, ) -> None: """Change state of a WLED Light segment. @@ -355,6 +356,7 @@ async def segment( # noqa: PLR0912, PLR0913 transition: Duration of the crossfade between different colors/brightness levels. One unit is 100ms, so a value of 4 results in a transition of 400ms. + cct: White spectrum color temperature. Raises: ------ @@ -383,6 +385,7 @@ async def segment( # noqa: PLR0912, PLR0913 "start": start, "stop": stop, "sx": speed, + "cct": cct, } # Find effect if it was based on a name From 50912c8406116b9d71dadb136178f18501a4257a Mon Sep 17 00:00:00 2001 From: Suxsem Date: Sat, 20 Jul 2024 14:55:48 +0200 Subject: [PATCH 3/3] No alias for cct; fix format --- src/wled/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wled/models.py b/src/wled/models.py index 96266353..52f94e87 100644 --- a/src/wled/models.py +++ b/src/wled/models.py @@ -287,13 +287,14 @@ class Segment(BaseModel): from top-left corner of the matrix. """ - cct: int = field(default=0, metadata=field_options(alias="cct")) + cct: int = field(default=0) """White spectrum color temperature. 0 indicates the warmest possible color temperature, 255 indicates the coldest temperature """ + @dataclass(kw_only=True) class Leds: """Object holding leds info from WLED."""