Handle ghost zones gracefully (#31008)

This commit is contained in:
David Bonnes 2020-01-20 20:49:04 +00:00 committed by GitHub
parent 662c12715e
commit 8f37c843f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 10 deletions

View File

@ -97,16 +97,25 @@ async def async_setup_platform(
zones = []
for zone in broker.tcs.zones.values():
_LOGGER.debug(
"Found a %s (%s), id=%s, name=%s",
zone.zoneType,
zone.modelType,
zone.zoneId,
zone.name,
)
new_entity = EvoZone(broker, zone)
if zone.zoneType == "Unknown":
_LOGGER.warning(
"Ignoring: %s (%s), id=%s, name=%s: invalid zone type",
zone.zoneType,
zone.modelType,
zone.zoneId,
zone.name,
)
else:
_LOGGER.debug(
"Adding: %s (%s), id=%s, name=%s",
zone.zoneType,
zone.modelType,
zone.zoneId,
zone.name,
)
zones.append(new_entity)
new_entity = EvoZone(broker, zone)
zones.append(new_entity)
async_add_entities([controller] + zones, update_before_add=True)

View File

@ -34,7 +34,7 @@ async def async_setup_platform(
broker = hass.data[DOMAIN]["broker"]
_LOGGER.debug(
"Found the DHW Controller (%s), id: %s",
"Adding: DhwController (%s), id=%s",
broker.tcs.hotwater.zone_type,
broker.tcs.hotwater.zoneId,
)