From ef1cbd3aea09a3d550bdbc2c5c1f0af505d050cf Mon Sep 17 00:00:00 2001 From: dasos Date: Mon, 4 Dec 2017 13:55:04 +0000 Subject: [PATCH] Tado ignore invalid devices (#10927) * Ignore devices without temperatures * Typo * Linting * Removing return false * Another typo. :( * Spelling received correctly --- homeassistant/components/climate/tado.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/climate/tado.py b/homeassistant/components/climate/tado.py index d58acac5373..a8054b838ef 100644 --- a/homeassistant/components/climate/tado.py +++ b/homeassistant/components/climate/tado.py @@ -59,8 +59,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None): climate_devices = [] for zone in zones: - climate_devices.append(create_climate_device( - tado, hass, zone, zone['name'], zone['id'])) + device = create_climate_device( + tado, hass, zone, zone['name'], zone['id']) + if not device: + continue + climate_devices.append(device) if climate_devices: add_devices(climate_devices, True) @@ -75,8 +78,11 @@ def create_climate_device(tado, hass, zone, name, zone_id): if ac_mode: temperatures = capabilities['HEAT']['temperatures'] - else: + elif 'temperatures' in capabilities: temperatures = capabilities['temperatures'] + else: + _LOGGER.debug("Received zone %s has no temperature; not adding", name) + return min_temp = float(temperatures['celsius']['min']) max_temp = float(temperatures['celsius']['max'])