-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from bdraco/cover
Fix missing effects on dimmable white bulbs and add test coverage
- Loading branch information
Showing
6 changed files
with
143 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Tests for the Bulb API with a light strip.""" | ||
from typing import AsyncGenerator | ||
|
||
import pytest | ||
|
||
from pywizlight import wizlight | ||
from pywizlight.bulblibrary import BulbClass, BulbType, Features, KelvinRange | ||
from pywizlight.tests.fake_bulb import startup_bulb | ||
|
||
|
||
@pytest.fixture() | ||
async def dimmable_bulb() -> AsyncGenerator[wizlight, None]: | ||
shutdown, port = await startup_bulb( | ||
module_name="ESP06_SHDW9_01", firmware_version="1.11.7" | ||
) | ||
bulb = wizlight(ip="127.0.0.1", port=port) | ||
yield bulb | ||
await bulb.async_close() | ||
shutdown() | ||
|
||
|
||
# These have a cnx value in the response. Unknown what it means | ||
# {"method":"getPilot","env":"pro","result":{"mac":"a8bb509f71d1","rssi":-54,"cnx":"0000","src":"","state":true,"sceneId":0,"temp":2700,"dimming":100}} | ||
# {"method":"syncPilot","id":25,"env":"pro","params":{"mac":"a8bb509f71d1","rssi":-55,"cnx":"0000","src":"udp","state":true,"sceneId":0,"temp":2700,"dimming":100}} | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_model_description_dimmable_bulb(dimmable_bulb: wizlight) -> None: | ||
"""Test fetching the model description dimmable bulb.""" | ||
bulb_type = await dimmable_bulb.get_bulbtype() | ||
assert bulb_type == BulbType( | ||
features=Features(color=False, color_tmp=False, effect=True, brightness=True), | ||
name="ESP06_SHDW9_01", | ||
kelvin_range=KelvinRange(max=6500, min=2700), | ||
bulb_type=BulbClass.DW, | ||
fw_version="1.11.7", | ||
white_channels=1, | ||
white_to_color_ratio=20, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Tests for the Bulb API with a light strip.""" | ||
from typing import AsyncGenerator | ||
|
||
import pytest | ||
|
||
from pywizlight import wizlight | ||
from pywizlight.bulblibrary import BulbClass, BulbType, Features, KelvinRange | ||
from pywizlight.tests.fake_bulb import startup_bulb | ||
|
||
|
||
@pytest.fixture() | ||
async def turnable_bulb() -> AsyncGenerator[wizlight, None]: | ||
shutdown, port = await startup_bulb( | ||
module_name="ESP14_SHTW1C_01", firmware_version="1.18.0" | ||
) | ||
bulb = wizlight(ip="127.0.0.1", port=port) | ||
yield bulb | ||
await bulb.async_close() | ||
shutdown() | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_model_description_dimmable_bulb(turnable_bulb: wizlight) -> None: | ||
"""Test fetching the model description dimmable bulb.""" | ||
bulb_type = await turnable_bulb.get_bulbtype() | ||
assert bulb_type == BulbType( | ||
features=Features(color=False, color_tmp=True, effect=True, brightness=True), | ||
name="ESP14_SHTW1C_01", | ||
kelvin_range=KelvinRange(max=6500, min=2700), | ||
bulb_type=BulbClass.TW, | ||
fw_version="1.18.0", | ||
white_channels=1, | ||
white_to_color_ratio=20, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters