Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/wled/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class Segment:
color_primary: tuple[int, int, int, int] | tuple[int, int, int]
color_secondary: tuple[int, int, int, int] | tuple[int, int, int]
color_tertiary: tuple[int, int, int, int] | tuple[int, int, int]
cct: int
effect: Effect
intensity: int
length: int
Expand Down Expand Up @@ -183,6 +184,7 @@ def from_dict( # noqa: PLR0913
color_primary=primary_color, # type: ignore[arg-type]
color_secondary=secondary_color, # type: ignore[arg-type]
color_tertiary=tertiary_color, # type: ignore[arg-type]
cct=data.get("cct", 0),
effect=effect,
intensity=data.get("ix", 0),
length=length,
Expand Down
8 changes: 8 additions & 0 deletions src/wled/wled.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ async def master(
brightness: int | None = None,
on: bool | None = None,
transition: int | None = None,
cct: int | None = None
) -> None:
"""Change master state of a WLED Light device.

Expand All @@ -353,6 +354,7 @@ async def master(
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:
"""
state: dict[str, bool | int] = {}

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

if cct is not None:
state["cct"] = cct

await self.request("/json/state", method="POST", data=state)

# pylint: disable=too-many-locals, too-many-branches, too-many-arguments
Expand Down Expand Up @@ -392,6 +397,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.

Expand Down Expand Up @@ -420,6 +426,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: The white spectrum color temperature.

Raises:
------
Expand Down Expand Up @@ -447,6 +454,7 @@ async def segment( # noqa: PLR0912, PLR0913
"start": start,
"stop": stop,
"sx": speed,
"cct": cct
}

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