mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-21 12:10:25 +00:00
Change state_information to return feature values (#804)
This changes `state_information` to return the names and values of all defined features. It was originally a "temporary" hack to show some extra, device-specific information in the cli tool, but now that we have device-defined features we can leverage them.
This commit is contained in:
@@ -42,11 +42,8 @@ async def test_bulb_sysinfo(dev: Bulb):
|
||||
|
||||
@bulb
|
||||
async def test_state_attributes(dev: Bulb):
|
||||
assert "Brightness" in dev.state_information
|
||||
assert dev.state_information["Brightness"] == dev.brightness
|
||||
|
||||
assert "Is dimmable" in dev.state_information
|
||||
assert dev.state_information["Is dimmable"] == dev.is_dimmable
|
||||
assert "Cloud connection" in dev.state_information
|
||||
assert isinstance(dev.state_information["Cloud connection"], bool)
|
||||
|
||||
|
||||
@bulb_iot
|
||||
@@ -114,6 +111,7 @@ async def test_invalid_hsv(dev: Bulb, turn_on):
|
||||
|
||||
|
||||
@color_bulb
|
||||
@pytest.mark.skip("requires color feature")
|
||||
async def test_color_state_information(dev: Bulb):
|
||||
assert "HSV" in dev.state_information
|
||||
assert dev.state_information["HSV"] == dev.hsv
|
||||
@@ -130,6 +128,7 @@ async def test_hsv_on_non_color(dev: Bulb):
|
||||
|
||||
|
||||
@variable_temp
|
||||
@pytest.mark.skip("requires colortemp module")
|
||||
async def test_variable_temp_state_information(dev: Bulb):
|
||||
assert "Color temperature" in dev.state_information
|
||||
assert dev.state_information["Color temperature"] == dev.color_temp
|
||||
|
||||
Reference in New Issue
Block a user