Skip to content

Commit

Permalink
Tado ignore invalid devices (#10927)
Browse files Browse the repository at this point in the history
* Ignore devices without temperatures

* Typo

* Linting

* Removing return false

* Another typo. :(

* Spelling received correctly
  • Loading branch information
dasos authored and MartinHjelmare committed Dec 4, 2017
1 parent 31cedf8 commit ef1cbd3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions homeassistant/components/climate/tado.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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'])
Expand Down

0 comments on commit ef1cbd3

Please sign in to comment.