Min max temp for thermostat

This commit is contained in:
Daniel Hoyer Iversen 2015-07-23 22:15:17 +02:00
parent cbb390a918
commit be937a795a
2 changed files with 25 additions and 17 deletions

View File

@ -133,21 +133,8 @@ class ThermostatDevice(Entity):
if device_attr is not None:
data.update(device_attr)
if hasattr(self, ATTR_MIN_TEMP):
min_temp = self.hass.config.temperature(
getattr(self, ATTR_MIN_TEMP), self.unit_of_measurement)[0]
else:
min_temp = self.hass.config.temperature(
7, TEMP_CELCIUS)[0]
data[ATTR_MIN_TEMP] = min_temp
if hasattr(self, ATTR_MAX_TEMP):
max_temp = self.hass.config.temperature(
getattr(self, ATTR_MAX_TEMP), self.unit_of_measurement)[0]
else:
max_temp = self.hass.config.temperature(
35, TEMP_CELCIUS)[0]
data[ATTR_MAX_TEMP] = max_temp
data[ATTR_MIN_TEMP] = self.min_temp
data[ATTR_MAX_TEMP] = self.max_temp
return data
@ -180,3 +167,13 @@ class ThermostatDevice(Entity):
def turn_away_mode_off(self):
""" Turns away mode off. """
pass
@property
def min_temp(self):
""" Return minimum temperature. """
return self.hass.config.temperature(7, TEMP_CELCIUS)[0]
@property
def max_temp(self):
""" Return maxmum temperature. """
return self.hass.config.temperature(35, TEMP_CELCIUS)[0]

View File

@ -62,6 +62,7 @@ import logging
import datetime
import homeassistant.components as core
import homeassistant.util as util
from homeassistant.components.thermostat import ThermostatDevice
from homeassistant.const import TEMP_CELCIUS, STATE_ON, STATE_OFF
@ -100,8 +101,8 @@ class HeatControl(ThermostatDevice):
datetime.datetime.strptime(time_end, '%H%M'))
self.time_temp.append((start_time, end_time, float(temp)))
self.min_temp = float(config.get("min_temp"))
self.max_temp = float(config.get("max_temp"))
self._min_temp = util.convert(config.get("min_temp"), float, 0)
self._max_temp = util.convert(config.get("max_temp"), float, 100)
self._manual_sat_temp = None
self._away = False
@ -196,3 +197,13 @@ class HeatControl(ThermostatDevice):
def turn_away_mode_off(self):
""" Turns away mode off. """
self._away = False
@property
def min_temp(self):
""" Return minimum temperature. """
return self._min_temp
@property
def max_temp(self):
""" Return maxmum temperature. """
return self._max_temp