-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
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
Tado ignore invalid devices #10927
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 device is False: | ||
continue | ||
climate_devices.append(device) | ||
|
||
if climate_devices: | ||
add_devices(climate_devices, True) | ||
|
@@ -75,8 +78,12 @@ def create_climate_device(tado, hass, zone, name, zone_id): | |
|
||
if ac_mode: | ||
temperatures = capabilities['HEAT']['temperatures'] | ||
else: | ||
elif 'temperatures' in capabilities: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I misread the code. Sorry for the noise! |
||
temperatures = capabilities['temperatures'] | ||
temperatures = capabilities['temperatures'] | ||
else: | ||
_LOGGER.debug("Recieved zone %s has no temperature; not adding", name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: Received |
||
return False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bad design to return False if you want have a object. Do only |
||
|
||
min_temp = float(temperatures['celsius']['min']) | ||
max_temp = float(temperatures['celsius']['max']) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not device: