Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tado ignore invalid devices #10927

Merged
merged 6 commits into from
Dec 4, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did the structure of the capabilities dict change? Because if not, you are now missing the ['HEAT'] part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the structure hasn't changed. All I've changed is checking that the temperatures key exists in the provided data. Previously it was assuming it was there, and for some devices (ie, hot water control) it is not. Obviously this then caused a KeyError as in #9530

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I misread the code. Sorry for the noise!

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