Skip to content
Merged
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
8 changes: 4 additions & 4 deletions pyomnilogic_local/colorlogiclight.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def state(self) -> ColorLogicPowerState:
@property
def show(self) -> LightShows:
"""Returns the current light show."""
return self.telemetry.show
return self.telemetry.show_name(self.model, self.v2_active)

@property
def speed(self) -> ColorLogicSpeed:
Expand Down Expand Up @@ -282,7 +282,7 @@ async def set_show(
await self._api.async_set_light_show(
self.bow_id,
self.system_id,
show or self.show, # use current value if None
speed or self.speed, # use current value if None
brightness or self.brightness, # use current value if None
show if show is not None else self.show, # use current value if None
speed if speed is not None else self.speed, # use current value if None
brightness if brightness is not None else self.brightness, # use current value if None
)
10 changes: 5 additions & 5 deletions pyomnilogic_local/models/mspconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,13 @@ class MSPColorLogicLight(OmniBase):

omni_type: OmniType = OmniType.CL_LIGHT

equip_type: ColorLogicLightType = Field(alias="Type")
v2_active: bool = Field(alias="V2-Active", default=False)
equip_type: ColorLogicLightType = Field(alias="Type")
effects: list[LightShows] | None = None

def __init__(self, **data: Any) -> None:
super().__init__(**data)

# Get the available light shows depending on the light type.
@model_validator(mode="after")
def set_effects(self) -> Any:
"""Set the available light shows based on the light type."""
match self.equip_type:
case ColorLogicLightType.TWO_FIVE:
self.effects = list(ColorLogicShow25)
Expand All @@ -311,6 +310,7 @@ def __init__(self, **data: Any) -> None:
self.effects = list(PentairShow)
case ColorLogicLightType.ZODIAC_COLOR:
self.effects = list(ZodiacShow)
return self


class MSPGroup(OmniBase):
Expand Down
5 changes: 3 additions & 2 deletions pyomnilogic_local/models/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class TelemetryColorLogicLight(BaseModel):

def show_name(
self, model: ColorLogicLightType, v2: bool
) -> ColorLogicShow25 | ColorLogicShow40 | ColorLogicShowUCL | ColorLogicShowUCLV2 | PentairShow | ZodiacShow | int:
) -> ColorLogicShow25 | ColorLogicShow40 | ColorLogicShowUCL | ColorLogicShowUCLV2 | PentairShow | ZodiacShow:
"""Get the current light show depending on the light type.

Returns:
Expand All @@ -287,7 +287,8 @@ def show_name(
return PentairShow(self.show)
case ColorLogicLightType.ZODIAC_COLOR:
return ZodiacShow(self.show)
return self.show # Return raw int if type is unknown
msg = f"Unknown ColorLogicLightType {model} for show name parsing"
raise OmniParsingError(msg)


class TelemetryFilter(BaseModel):
Expand Down
Loading