Skip to content

Commit 11a9f0b

Browse files
committed
Added CCT support
1 parent d88255c commit 11a9f0b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/wled/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class Segment:
117117
color_primary: tuple[int, int, int, int] | tuple[int, int, int]
118118
color_secondary: tuple[int, int, int, int] | tuple[int, int, int]
119119
color_tertiary: tuple[int, int, int, int] | tuple[int, int, int]
120+
cct: int
120121
effect: Effect
121122
intensity: int
122123
length: int
@@ -183,6 +184,7 @@ def from_dict( # noqa: PLR0913
183184
color_primary=primary_color, # type: ignore[arg-type]
184185
color_secondary=secondary_color, # type: ignore[arg-type]
185186
color_tertiary=tertiary_color, # type: ignore[arg-type]
187+
cct=data.get("cct", 0),
186188
effect=effect,
187189
intensity=data.get("ix", 0),
188190
length=length,

src/wled/wled.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ async def master(
343343
brightness: int | None = None,
344344
on: bool | None = None,
345345
transition: int | None = None,
346+
cct: int | None = None
346347
) -> None:
347348
"""Change master state of a WLED Light device.
348349
@@ -353,6 +354,7 @@ async def master(
353354
transition: Duration of the crossfade between different
354355
colors/brightness levels. One unit is 100ms, so a value of 4
355356
results in a transition of 400ms.
357+
cct:
356358
"""
357359
state: dict[str, bool | int] = {}
358360

@@ -365,6 +367,9 @@ async def master(
365367
if transition is not None:
366368
state["tt"] = transition
367369

370+
if cct is not None:
371+
state["cct"] = cct
372+
368373
await self.request("/json/state", method="POST", data=state)
369374

370375
# pylint: disable=too-many-locals, too-many-branches, too-many-arguments
@@ -392,6 +397,7 @@ async def segment( # noqa: PLR0912, PLR0913
392397
start: int | None = None,
393398
stop: int | None = None,
394399
transition: int | None = None,
400+
cct: int | None = None
395401
) -> None:
396402
"""Change state of a WLED Light segment.
397403
@@ -420,6 +426,7 @@ async def segment( # noqa: PLR0912, PLR0913
420426
transition: Duration of the crossfade between different
421427
colors/brightness levels. One unit is 100ms, so a value of 4
422428
results in a transition of 400ms.
429+
cct: The white spectrum color temperature.
423430
424431
Raises:
425432
------
@@ -447,6 +454,7 @@ async def segment( # noqa: PLR0912, PLR0913
447454
"start": start,
448455
"stop": stop,
449456
"sx": speed,
457+
"cct": cct
450458
}
451459

452460
# > WLED 0.10.0, does not support segment control on/bri.

0 commit comments

Comments
 (0)