Improve evohome exception handling and fix bugs (#22140)

* Use latest client library, evohomeclient v0.3.1

* Fix issue #22097: Failed to call service climate/turn_on...

* BUGFIX: handle case where a Zone doesn't have a temperature

* BUGFIX: missing exception handler, and inappropriate delint hints

* Improve exception handling, and also better messages

* improve code (REDACT secrets); remove TODOs

* minor refactor - improve error message

* more refactoring - improve error message

* remove TODOs

* update to latest evohomeclient library

* Use latest client library, evohomeclient v0.3.1

* Fix issue #22097: Failed to call service climate/turn_on...

* BUGFIX: handle case where a Zone doesn't have a temperature

* BUGFIX: missing exception handler, and inappropriate delint hints

* Improve exception handling, and also better messages

* improve code (REDACT secrets); remove TODOs

* minor refactor - improve error message

* more refactoring - improve error message

* remove TODOs

* update to latest evohomeclient library

* fix requests for houndci-bot

* Tidy up requests exception handling

* Correct lint error

* update to latest client library

* minor de-lint

* more cleanup of exceptions, messages

* refactored for new exception

* fix error in requirements*_all.txt

* de-lint

* delint unused import

* import 3rd-party library only inside methods

* change honeywell tests

* delint, fix typo

* we dont log usernames, passwords, etc.

* de-lint
This commit is contained in:
David Bonnes 2019-04-02 14:11:26 +01:00 committed by Martin Hjelmare
parent 16e0953f26
commit 3bd37d6a65
6 changed files with 107 additions and 78 deletions

View file

@ -5,7 +5,6 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/climate.honeywell/
"""
import logging
import socket
import datetime
import requests
@ -21,7 +20,7 @@ from homeassistant.const import (
CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS, TEMP_FAHRENHEIT,
ATTR_TEMPERATURE, CONF_REGION)
REQUIREMENTS = ['evohomeclient==0.2.8', 'somecomfort==0.5.2']
REQUIREMENTS = ['evohomeclient==0.3.2', 'somecomfort==0.5.2']
_LOGGER = logging.getLogger(__name__)
@ -78,9 +77,10 @@ def _setup_round(username, password, config, add_entities):
[RoundThermostat(evo_api, zone['id'], i == 0, away_temp)],
True
)
except socket.error:
except requests.exceptions.RequestException as err:
_LOGGER.error(
"Connection error logging into the honeywell evohome web service")
"Connection error logging into the honeywell evohome web service, "
"hint: %s", err)
return False
return True