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:
Teemu R
2024-03-26 19:28:39 +01:00
committed by GitHub
parent d63f43a230
commit 35dbda7049
13 changed files with 70 additions and 115 deletions

View File

@@ -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