Skip to content

Commit 023d18f

Browse files
authored
fix: expose equip_type consistently across all omni types (#92)
1 parent 34d6f64 commit 023d18f

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

pyomnilogic_local/colorlogiclight.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def __init__(self, omni: OmniLogic, mspconfig: MSPColorLogicLight, telemetry: Te
117117
super().__init__(omni, mspconfig, telemetry)
118118

119119
@property
120-
def model(self) -> ColorLogicLightType:
120+
def equip_type(self) -> ColorLogicLightType:
121121
"""Returns the model of the light."""
122122
return self.mspconfig.equip_type
123123

@@ -168,20 +168,30 @@ def state(self) -> ColorLogicPowerState:
168168
@property
169169
def show(self) -> LightShows:
170170
"""Returns the current light show."""
171-
return self.telemetry.show_name(self.model, self.v2_active)
171+
return self.telemetry.show_name(self.equip_type, self.v2_active)
172172

173173
@property
174174
def speed(self) -> ColorLogicSpeed:
175175
"""Returns the current speed."""
176-
if self.model in [ColorLogicLightType.SAM, ColorLogicLightType.TWO_FIVE, ColorLogicLightType.FOUR_ZERO, ColorLogicLightType.UCL]:
176+
if self.equip_type in [
177+
ColorLogicLightType.SAM,
178+
ColorLogicLightType.TWO_FIVE,
179+
ColorLogicLightType.FOUR_ZERO,
180+
ColorLogicLightType.UCL,
181+
]:
177182
return self.telemetry.speed
178183
# Non color-logic lights only support 1x speed
179184
return ColorLogicSpeed.ONE_TIMES
180185

181186
@property
182187
def brightness(self) -> ColorLogicBrightness:
183188
"""Returns the current brightness."""
184-
if self.model in [ColorLogicLightType.SAM, ColorLogicLightType.TWO_FIVE, ColorLogicLightType.FOUR_ZERO, ColorLogicLightType.UCL]:
189+
if self.equip_type in [
190+
ColorLogicLightType.SAM,
191+
ColorLogicLightType.TWO_FIVE,
192+
ColorLogicLightType.FOUR_ZERO,
193+
ColorLogicLightType.UCL,
194+
]:
185195
return self.telemetry.brightness
186196
# Non color-logic lights only support 100% brightness
187197
return ColorLogicBrightness.ONE_HUNDRED_PERCENT
@@ -262,17 +272,17 @@ async def set_show(
262272
and a warning will be logged.
263273
"""
264274
# Non color-logic lights do not support speed or brightness control
265-
if self.model not in [
275+
if self.equip_type not in [
266276
ColorLogicLightType.SAM,
267277
ColorLogicLightType.TWO_FIVE,
268278
ColorLogicLightType.FOUR_ZERO,
269279
ColorLogicLightType.UCL,
270280
]:
271281
if speed is not None:
272-
_LOGGER.warning("Non colorlogic lights do not support speed control %s", self.model.name)
282+
_LOGGER.warning("Non colorlogic lights do not support speed control %s", self.equip_type.name)
273283
speed = ColorLogicSpeed.ONE_TIMES
274284
if brightness is not None:
275-
_LOGGER.warning("Non colorlogic lights do not support brightness control %s", self.model.name)
285+
_LOGGER.warning("Non colorlogic lights do not support brightness control %s", self.equip_type.name)
276286
brightness = ColorLogicBrightness.ONE_HUNDRED_PERCENT
277287

278288
if self.bow_id is None or self.system_id is None:

pyomnilogic_local/sensor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __init__(self, omni: OmniLogic, mspconfig: MSPSensor, telemetry: Telemetry |
8686
super().__init__(omni, mspconfig, telemetry)
8787

8888
@property
89-
def sensor_type(self) -> SensorType | str:
89+
def equip_type(self) -> SensorType | str:
9090
"""Returns the type of sensor.
9191
9292
Can be AIR_TEMP, SOLAR_TEMP, WATER_TEMP, FLOW, ORP, or EXT_INPUT.

0 commit comments

Comments
 (0)