Skip to content
Snippets Groups Projects
Commit 1e0e48fc authored by Fabian Affolter's avatar Fabian Affolter
Browse files

Use logger the same as other platforms do

parent f2fda291
No related branches found
No related tags found
No related merge requests found
"""
homeassistant.components.thermostat.radiotherm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adds support for Radio Thermostat wifi-enabled home thermostats.
Adds support for Radio Thermostat wifi-enabled home thermostats.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.radiotherm.html
......@@ -15,16 +15,14 @@ from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL,
from homeassistant.const import (CONF_HOST, TEMP_FAHRENHEIT)
REQUIREMENTS = ['radiotherm==1.2']
HOLD_TEMP = 'hold_temp'
_LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Radio Thermostat. """
import radiotherm
logger = logging.getLogger(__name__)
hosts = []
if CONF_HOST in config:
hosts = config[CONF_HOST]
......@@ -32,7 +30,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
hosts.append(radiotherm.discover.discover_address())
if hosts is None:
logger.error("no radiotherm thermostats detected")
_LOGGER.error("No radiotherm thermostats detected")
return
hold_temp = config.get(HOLD_TEMP, False)
......@@ -43,8 +41,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
tstat = radiotherm.get_thermostat(host)
tstats.append(RadioThermostat(tstat, hold_temp))
except (URLError, OSError):
logger.exception(
"Unable to connect to Radio Thermostat: %s", host)
_LOGGER.exception("Unable to connect to Radio Thermostat: %s",
host)
add_devices(tstats)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment