File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed
Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,7 @@ def state(self) -> ColorLogicPowerState:
168168 @property
169169 def show (self ) -> LightShows :
170170 """Returns the current light show."""
171- return self .telemetry .show
171+ return self .telemetry .show_name ( self . model , self . v2_active )
172172
173173 @property
174174 def speed (self ) -> ColorLogicSpeed :
@@ -282,7 +282,7 @@ async def set_show(
282282 await self ._api .async_set_light_show (
283283 self .bow_id ,
284284 self .system_id ,
285- show or self .show , # use current value if None
286- speed or self .speed , # use current value if None
287- brightness or self .brightness , # use current value if None
285+ show if show is not None else self .show , # use current value if None
286+ speed if speed is not None else self .speed , # use current value if None
287+ brightness if brightness is not None else self .brightness , # use current value if None
288288 )
Original file line number Diff line number Diff line change @@ -289,14 +289,13 @@ class MSPColorLogicLight(OmniBase):
289289
290290 omni_type : OmniType = OmniType .CL_LIGHT
291291
292- equip_type : ColorLogicLightType = Field (alias = "Type" )
293292 v2_active : bool = Field (alias = "V2-Active" , default = False )
293+ equip_type : ColorLogicLightType = Field (alias = "Type" )
294294 effects : list [LightShows ] | None = None
295295
296- def __init__ (self , ** data : Any ) -> None :
297- super ().__init__ (** data )
298-
299- # Get the available light shows depending on the light type.
296+ @model_validator (mode = "after" )
297+ def set_effects (self ) -> Any :
298+ """Set the available light shows based on the light type."""
300299 match self .equip_type :
301300 case ColorLogicLightType .TWO_FIVE :
302301 self .effects = list (ColorLogicShow25 )
@@ -311,6 +310,7 @@ def __init__(self, **data: Any) -> None:
311310 self .effects = list (PentairShow )
312311 case ColorLogicLightType .ZODIAC_COLOR :
313312 self .effects = list (ZodiacShow )
313+ return self
314314
315315
316316class MSPGroup (OmniBase ):
Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ class TelemetryColorLogicLight(BaseModel):
267267
268268 def show_name (
269269 self , model : ColorLogicLightType , v2 : bool
270- ) -> ColorLogicShow25 | ColorLogicShow40 | ColorLogicShowUCL | ColorLogicShowUCLV2 | PentairShow | ZodiacShow | int :
270+ ) -> ColorLogicShow25 | ColorLogicShow40 | ColorLogicShowUCL | ColorLogicShowUCLV2 | PentairShow | ZodiacShow :
271271 """Get the current light show depending on the light type.
272272
273273 Returns:
@@ -287,7 +287,8 @@ def show_name(
287287 return PentairShow (self .show )
288288 case ColorLogicLightType .ZODIAC_COLOR :
289289 return ZodiacShow (self .show )
290- return self .show # Return raw int if type is unknown
290+ msg = f"Unknown ColorLogicLightType { model } for show name parsing"
291+ raise OmniParsingError (msg )
291292
292293
293294class TelemetryFilter (BaseModel ):
You can’t perform that action at this time.
0 commit comments