Always request at least one zone for multi-zone LIFX devices (#92683)

This commit is contained in:
J. Nick Koston
2023-05-11 12:02:32 +02:00
committed by GitHub
parent c1f716487c
commit 52c773a776
2 changed files with 51 additions and 6 deletions
+10
View File
@@ -1754,6 +1754,8 @@ async def test_light_strip_zones_not_populated_yet(hass: HomeAssistant) -> None:
bulb.power_level = 65535
bulb.color_zones = None
bulb.color = [65535, 65535, 65535, 65535]
assert bulb.get_color_zones.calls == []
with _patch_discovery(device=bulb), _patch_config_flow_try_connect(
device=bulb
), _patch_device(device=bulb):
@@ -1761,6 +1763,14 @@ async def test_light_strip_zones_not_populated_yet(hass: HomeAssistant) -> None:
await hass.async_block_till_done()
entity_id = "light.my_bulb"
# Make sure we at least try to fetch the first zone
# to ensure we populate the zones from the 503 response
assert len(bulb.get_color_zones.calls) == 3
# Once to populate the number of zones
assert bulb.get_color_zones.calls[0][1]["start_index"] == 0
# Again once we know the number of zones
assert bulb.get_color_zones.calls[1][1]["start_index"] == 0
assert bulb.get_color_zones.calls[2][1]["start_index"] == 8
state = hass.states.get(entity_id)
assert state.state == "on"