From e00388eea0ccc7256a29de7d685dbdfbfae57e4b Mon Sep 17 00:00:00 2001 From: David Bonnes Date: Tue, 21 Jan 2020 18:49:15 +0000 Subject: [PATCH] switch evohome to use a whitelist for valid zonetype (#31047) --- homeassistant/components/evohome/__init__.py | 3 ++- homeassistant/components/evohome/climate.py | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/evohome/__init__.py b/homeassistant/components/evohome/__init__.py index b9d3f35964a..949471d64d0 100644 --- a/homeassistant/components/evohome/__init__.py +++ b/homeassistant/components/evohome/__init__.py @@ -663,7 +663,8 @@ class EvoChild(EvoDevice): except IndexError: self._setpoints = {} _LOGGER.warning( - "Failed to get setpoints - please report as an issue", exc_info=True + "Failed to get setpoints, report as an issue if this error persists", + exc_info=True, ) return self._setpoints diff --git a/homeassistant/components/evohome/climate.py b/homeassistant/components/evohome/climate.py index 46a4fbf335c..b7f6e965a8f 100644 --- a/homeassistant/components/evohome/climate.py +++ b/homeassistant/components/evohome/climate.py @@ -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)