Skip to content

Commit

Permalink
Fix reporting available scenes on RGB devices
Browse files Browse the repository at this point in the history
- Add coverage for scenes
  • Loading branch information
bdraco committed Feb 10, 2022
1 parent 0b11c5f commit 465ff0a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pywizlight/scenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
DW_SCENES = [9, 10, 13, 14, 29, 30, 31, 32]

SCENES_BY_CLASS: Dict[BulbClass, List[str]] = {
BulbClass.RGB: list(cast(Iterable, SCENES)),
BulbClass.RGB: list(cast(Iterable, SCENES.values())),
BulbClass.TW: [SCENES[key] for key in TW_SCENES],
BulbClass.DW: [SCENES[key] for key in DW_SCENES],
}
Expand Down
15 changes: 15 additions & 0 deletions pywizlight/tests/test_bulb_dimmable_white.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@ async def test_model_description_dimmable_bulb(dimmable_bulb: wizlight) -> None:
white_channels=1,
white_to_color_ratio=20,
)


@pytest.mark.asyncio
async def test_supported_scenes(dimmable_bulb: wizlight) -> None:
"""Test supported scenes."""
assert await dimmable_bulb.getSupportedScenes() == [
"Wake up",
"Bedtime",
"Cool white",
"Night light",
"Candlelight",
"Golden white",
"Pulse",
"Steampunk",
]
40 changes: 40 additions & 0 deletions pywizlight/tests/test_bulb_light_strip_1_25_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,46 @@ async def test_setting_rgbww(light_strip: wizlight) -> None:
assert state and state.get_rgbww() == (1, 2, 3, 4, 5)


@pytest.mark.asyncio
async def test_supported_scenes(light_strip: wizlight) -> None:
"""Test supported scenes."""
assert await light_strip.getSupportedScenes() == [
"Ocean",
"Romance",
"Sunset",
"Party",
"Fireplace",
"Cozy",
"Forest",
"Pastel Colors",
"Wake up",
"Bedtime",
"Warm White",
"Daylight",
"Cool white",
"Night light",
"Focus",
"Relax",
"True colors",
"TV time",
"Plantgrowth",
"Spring",
"Summer",
"Fall",
"Deepdive",
"Jungle",
"Mojito",
"Club",
"Christmas",
"Halloween",
"Candlelight",
"Golden white",
"Pulse",
"Steampunk",
"Rhythm",
]


@pytest.mark.asyncio
async def test_model_description_light_strip(light_strip: wizlight) -> None:
"""Test fetching the model description for a light strip."""
Expand Down
6 changes: 6 additions & 0 deletions pywizlight/tests/test_bulb_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ async def test_model_description_socket(socket: wizlight) -> None:
white_channels=2,
white_to_color_ratio=20,
)


@pytest.mark.asyncio
async def test_supported_scenes(socket: wizlight) -> None:
"""Test supported scenes."""
assert await socket.getSupportedScenes() == []

0 comments on commit 465ff0a

Please sign in to comment.