switch evohome to use a whitelist for valid zonetype (#31047)

This commit is contained in:
David Bonnes 2020-01-21 18:49:15 +00:00 committed by GitHub
parent 19d30f0a1b
commit e00388eea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View file

@ -97,15 +97,7 @@ async def async_setup_platform(
zones = []
for zone in broker.tcs.zones.values():
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:
if zone.modelType == "HeatingZone" or zone.zoneType == "Thermostat":
_LOGGER.debug(
"Adding: %s (%s), id=%s, name=%s",
zone.zoneType,
@ -117,6 +109,16 @@ async def async_setup_platform(
new_entity = EvoZone(broker, zone)
zones.append(new_entity)
else:
_LOGGER.warning(
"Ignoring: %s (%s), id=%s, name=%s: unknown/invalid zone type, "
"report as an issue if you feel this zone type should be supported",
zone.zoneType,
zone.modelType,
zone.zoneId,
zone.name,
)
async_add_entities([controller] + zones, update_before_add=True)