From 37278aab20e8a85357eac2ed3a2e38747704c309 Mon Sep 17 00:00:00 2001 From: Todd Ingarfield Date: Sat, 10 Oct 2015 11:36:34 -0500 Subject: [PATCH] add set_time and begin discovery --- .../components/thermostat/radiotherm.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/thermostat/radiotherm.py b/homeassistant/components/thermostat/radiotherm.py index 6aee1aa061d..b0ae38461b3 100644 --- a/homeassistant/components/thermostat/radiotherm.py +++ b/homeassistant/components/thermostat/radiotherm.py @@ -4,13 +4,14 @@ homeassistant.components.thermostat.radiotherm Adds support for Radio Thermostat wifi-enabled home thermostats """ import logging +import datetime +from urllib.error import URLError from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, STATE_IDLE, STATE_HEAT) from homeassistant.const import (CONF_HOST, CONF_NAME, TEMP_FAHRENHEIT) -from urllib.error import URLError -REQUIREMENTS = ['radiotherm'] +REQUIREMENTS = ['radiotherm==1.2'] def setup_platform(hass, config, add_devices, discovery_info=None): @@ -25,6 +26,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None): "Did you maybe not install the radiotherm dependency?") return + hosts = [] + logger.info(discovery_info) + + host = config.get(CONF_HOST) name = config.get(CONF_NAME) if host is None: @@ -48,6 +53,7 @@ class RadioThermostat(ThermostatDevice): self.device = device if name: self.set_name(name) + self.set_time() @property def name(self): @@ -106,3 +112,9 @@ class RadioThermostat(ThermostatDevice): def set_name(self, name): """ Set thermostat name """ self.device.name = name + + def set_time(self): + """ Set device time """ + now = datetime.datetime.now() + self.device.time = {'day': now.weekday(), + 'hour': now.hour, 'minute': now.minute}