From e5d68d8a1e32e09d25c534a5eac8b5159a6301cb Mon Sep 17 00:00:00 2001 From: Todd Ingarfield Date: Fri, 9 Oct 2015 10:43:14 -0500 Subject: [PATCH] set name of device through hass config --- homeassistant/components/thermostat/radiotherm.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/thermostat/radiotherm.py b/homeassistant/components/thermostat/radiotherm.py index 28899fac56e..229fed220cd 100644 --- a/homeassistant/components/thermostat/radiotherm.py +++ b/homeassistant/components/thermostat/radiotherm.py @@ -27,6 +27,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): return host = config.get(CONF_HOST) + name = config.get(CONF_NAME) if host is None: logger.error("host not defined in config.") return @@ -38,7 +39,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): "Unable to connect to Radio Thermostat") return - add_devices([RadioThermostat(tstat)]) + add_devices([RadioThermostat(tstat, name)]) class RadioThermostat(ThermostatDevice): @@ -46,13 +47,13 @@ class RadioThermostat(ThermostatDevice): def __init__(self, device, name=None): self.device = device - self._name = name + if name: + self.set_name(name) @property def name(self): """ Returns the name of the Radio Thermostat. """ - return 'radiothermostat' - #return self.device.name + return self.device.name['raw'] @property def unit_of_measurement(self): @@ -98,12 +99,16 @@ class RadioThermostat(ThermostatDevice): return round(temp, 1) - def set_temperate(self, temperature): + def set_temperature(self, temperature): """ Set new target temperature """ if self.operation == STATE_COOL: self.device.t_cool = temperature elif self.operation == STATE_HEAT: self.device.t_heat + def set_name(self, name): + """ Set thermostat name """ + self.device.name = name +