add set_time and begin discovery

This commit is contained in:
Todd Ingarfield 2015-10-10 11:36:34 -05:00
parent a3d295d885
commit 37278aab20

View File

@ -4,13 +4,14 @@ homeassistant.components.thermostat.radiotherm
Adds support for Radio Thermostat wifi-enabled home thermostats Adds support for Radio Thermostat wifi-enabled home thermostats
""" """
import logging import logging
import datetime
from urllib.error import URLError
from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL, from homeassistant.components.thermostat import (ThermostatDevice, STATE_COOL,
STATE_IDLE, STATE_HEAT) STATE_IDLE, STATE_HEAT)
from homeassistant.const import (CONF_HOST, CONF_NAME, TEMP_FAHRENHEIT) 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): 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?") "Did you maybe not install the radiotherm dependency?")
return return
hosts = []
logger.info(discovery_info)
host = config.get(CONF_HOST) host = config.get(CONF_HOST)
name = config.get(CONF_NAME) name = config.get(CONF_NAME)
if host is None: if host is None:
@ -48,6 +53,7 @@ class RadioThermostat(ThermostatDevice):
self.device = device self.device = device
if name: if name:
self.set_name(name) self.set_name(name)
self.set_time()
@property @property
def name(self): def name(self):
@ -106,3 +112,9 @@ class RadioThermostat(ThermostatDevice):
def set_name(self, name): def set_name(self, name):
""" Set thermostat name """ """ Set thermostat name """
self.device.name = 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}