mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
add set_time and begin discovery
This commit is contained in:
parent
a3d295d885
commit
37278aab20
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user