Skip to content

Commit d4d89b4

Browse files
smatsmatssmatsmatsmdz
authored
expose cycleSpeed for color changing lights (#53)
* add COLOR_WHEEL light mode * expose cycleSpeed for color changing lights * update mock light to include cycleSpeed * add irt and exterior to mock light * ahem, fix spacing * added try for cycleSpeed, updated mock response * Make sure cycleSpeed is set, Apply suggestion from @mdz Co-authored-by: Matt Zimmerman <mdz@users.noreply.github.com> --------- Co-authored-by: smatsmats <willey@selby.com> Co-authored-by: Matt Zimmerman <mdz@users.noreply.github.com>
1 parent 243bb69 commit d4d89b4

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

smarttub/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ def __init__(self, spa: Spa, **properties):
527527

528528
self.intensity = properties["intensity"]
529529
self.mode = self.LightMode[properties["mode"]]
530+
self.cycleSpeed = properties.get("cycleSpeed", None)
530531
self.properties = properties
531532

532533
async def set_mode(self, mode: LightMode, intensity: int):
@@ -550,7 +551,7 @@ async def turn_off(self):
550551
await self.set_mode(self.LightMode.OFF, 0)
551552

552553
def __str__(self):
553-
return f"<SpaLight {self.zone}: {self.mode.name} (R {self.red}/G {self.green}/B {self.blue}/W {self.white}) @ {self.intensity}>"
554+
return f"<SpaLight {self.zone}: {self.mode.name} {self.cycleSpeed} (R {self.red}/G {self.green}/B {self.blue}/W {self.white}) @ {self.intensity}>"
554555

555556

556557
class SpaReminder:

tests/test_light.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ def lights(mock_spa):
1414
"color": {"blue": 0, "green": 0, "red": 0, "white": 0},
1515
"intensity": 0 if mode == SpaLight.LightMode.OFF else 50,
1616
"mode": mode.name,
17+
"cycleSpeed": 0,
18+
"exterior": False,
19+
"irt": None,
1720
"zone": i + 1,
1821
},
1922
)

tests/test_spa.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,7 @@ async def test_get_lights(mock_api, spa):
408408
{
409409
"color": {"blue": 0, "green": 0, "red": 0, "white": 0},
410410
"intensity": 0,
411+
"cycleSpeed": 0,
411412
"mode": "OFF",
412413
"zone": 1,
413414
}

0 commit comments

Comments
 (0)