mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Min max temp for thermostat
This commit is contained in:
parent
cbb390a918
commit
be937a795a
@ -133,21 +133,8 @@ class ThermostatDevice(Entity):
|
|||||||
if device_attr is not None:
|
if device_attr is not None:
|
||||||
data.update(device_attr)
|
data.update(device_attr)
|
||||||
|
|
||||||
if hasattr(self, ATTR_MIN_TEMP):
|
data[ATTR_MIN_TEMP] = self.min_temp
|
||||||
min_temp = self.hass.config.temperature(
|
data[ATTR_MAX_TEMP] = self.max_temp
|
||||||
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
|
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@ -180,3 +167,13 @@ class ThermostatDevice(Entity):
|
|||||||
def turn_away_mode_off(self):
|
def turn_away_mode_off(self):
|
||||||
""" Turns away mode off. """
|
""" Turns away mode off. """
|
||||||
pass
|
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]
|
||||||
|
@ -62,6 +62,7 @@ import logging
|
|||||||
import datetime
|
import datetime
|
||||||
import homeassistant.components as core
|
import homeassistant.components as core
|
||||||
|
|
||||||
|
import homeassistant.util as util
|
||||||
from homeassistant.components.thermostat import ThermostatDevice
|
from homeassistant.components.thermostat import ThermostatDevice
|
||||||
from homeassistant.const import TEMP_CELCIUS, STATE_ON, STATE_OFF
|
from homeassistant.const import TEMP_CELCIUS, STATE_ON, STATE_OFF
|
||||||
|
|
||||||
@ -100,8 +101,8 @@ class HeatControl(ThermostatDevice):
|
|||||||
datetime.datetime.strptime(time_end, '%H%M'))
|
datetime.datetime.strptime(time_end, '%H%M'))
|
||||||
self.time_temp.append((start_time, end_time, float(temp)))
|
self.time_temp.append((start_time, end_time, float(temp)))
|
||||||
|
|
||||||
self.min_temp = float(config.get("min_temp"))
|
self._min_temp = util.convert(config.get("min_temp"), float, 0)
|
||||||
self.max_temp = float(config.get("max_temp"))
|
self._max_temp = util.convert(config.get("max_temp"), float, 100)
|
||||||
|
|
||||||
self._manual_sat_temp = None
|
self._manual_sat_temp = None
|
||||||
self._away = False
|
self._away = False
|
||||||
@ -196,3 +197,13 @@ class HeatControl(ThermostatDevice):
|
|||||||
def turn_away_mode_off(self):
|
def turn_away_mode_off(self):
|
||||||
""" Turns away mode off. """
|
""" Turns away mode off. """
|
||||||
self._away = False
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user