mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 08:26:41 +01:00
Handle missing Daikin zone temperature keys (#164170)
Co-authored-by: barneyonline <barneyonline@users.noreply.github.com>
This commit is contained in:
@@ -115,7 +115,7 @@ def _zone_temperature_lists(device: Appliance) -> tuple[list[str], list[str]]:
|
||||
try:
|
||||
heating = device.represent(DAIKIN_ZONE_TEMP_HEAT)[1]
|
||||
cooling = device.represent(DAIKIN_ZONE_TEMP_COOL)[1]
|
||||
except AttributeError:
|
||||
except AttributeError, KeyError:
|
||||
return ([], [])
|
||||
return (list(heating or []), list(cooling or []))
|
||||
|
||||
|
||||
@@ -112,6 +112,27 @@ async def test_setup_entry_skips_zone_climates_without_support(
|
||||
assert _zone_entity_id(entity_registry, zone_device, 0) is None
|
||||
|
||||
|
||||
async def test_setup_entry_handles_missing_zone_temperature_key(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
zone_device: ZoneDevice,
|
||||
) -> None:
|
||||
"""Missing zone temperature keys do not break climate setup."""
|
||||
configure_zone_device(zone_device, zones=[["Living", "1", 22]])
|
||||
zone_device.values.pop("lztemp_h")
|
||||
|
||||
await _async_setup_daikin(hass, zone_device)
|
||||
|
||||
assert _zone_entity_id(entity_registry, zone_device, 0) is None
|
||||
main_entity_id = entity_registry.async_get_entity_id(
|
||||
CLIMATE_DOMAIN,
|
||||
DOMAIN,
|
||||
zone_device.mac,
|
||||
)
|
||||
assert main_entity_id is not None
|
||||
assert hass.states.get(main_entity_id) is not None
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("mode", "expected_zone_key"),
|
||||
[("hot", "lztemp_h"), ("cool", "lztemp_c")],
|
||||
|
||||
Reference in New Issue
Block a user