|
10 | 10 | from tests.common import ClusterListener
|
11 | 11 | import zhaquirks
|
12 | 12 | import zhaquirks.ikea.starkvind
|
| 13 | +from zhaquirks.ikea.starkvind import IkeaAirpurifier |
13 | 14 |
|
14 | 15 | zhaquirks.setup()
|
15 | 16 |
|
@@ -85,6 +86,33 @@ def test_ikea_starkvind_v2(assert_signature_matches_quirk):
|
85 | 86 | assert_signature_matches_quirk(zhaquirks.ikea.starkvind.IkeaSTARKVIND_v2, signature)
|
86 | 87 |
|
87 | 88 |
|
| 89 | +@pytest.mark.parametrize("attribute", ["fan_speed", "fan_mode"]) |
| 90 | +@pytest.mark.parametrize("value,expected", [ |
| 91 | + (0, 0), # off |
| 92 | + (1, 1), # auto |
| 93 | + (10, 2), |
| 94 | + (20, 4), |
| 95 | + (50, 10), |
| 96 | + ] |
| 97 | + ) |
| 98 | +async def test_fan_speed_mode_update(zigpy_device_from_quirk, attribute, value, expected): |
| 99 | + """Test reading the fan speed and mode.""" |
| 100 | + |
| 101 | + starkvind_device = zigpy_device_from_quirk(zhaquirks.ikea.starkvind.IkeaSTARKVIND) |
| 102 | + assert starkvind_device.model == "STARKVIND Air purifier" |
| 103 | + |
| 104 | + ikea_cluster = starkvind_device.endpoints[1].in_clusters[ |
| 105 | + zhaquirks.ikea.starkvind.IkeaAirpurifier.cluster_id |
| 106 | + ] |
| 107 | + ikea_listener = ClusterListener(ikea_cluster) |
| 108 | + |
| 109 | + attr_id = getattr(IkeaAirpurifier.AttributeDefs, attribute).id |
| 110 | + |
| 111 | + ikea_cluster.update_attribute(attr_id, value) |
| 112 | + assert len(ikea_listener.attribute_updates) == 1 |
| 113 | + assert ikea_listener.attribute_updates[0] == (attr_id, expected) |
| 114 | + |
| 115 | + |
88 | 116 | async def test_pm25_cluster_read(zigpy_device_from_quirk):
|
89 | 117 | """Test reading from PM25 cluster."""
|
90 | 118 |
|
|
0 commit comments