Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion homeassistant/components/thermostat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import homeassistant.util as util
from homeassistant.helpers.entity import Entity
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_ON, STATE_OFF)
ATTR_ENTITY_ID, ATTR_TEMPERATURE, STATE_ON, STATE_OFF, TEMP_CELCIUS)

DOMAIN = "thermostat"
DEPENDENCIES = []
Expand All @@ -24,6 +24,8 @@

ATTR_CURRENT_TEMPERATURE = "current_temperature"
ATTR_AWAY_MODE = "away_mode"
ATTR_MAX_TEMP = "max_temp"
ATTR_MIN_TEMP = "min_temp"

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -131,6 +133,9 @@ def state_attributes(self):
if device_attr is not None:
data.update(device_attr)

data[ATTR_MIN_TEMP] = self.min_temp
data[ATTR_MAX_TEMP] = self.max_temp

return data

@property
Expand Down Expand Up @@ -162,3 +167,13 @@ def turn_away_mode_on(self):
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]
35 changes: 24 additions & 11 deletions homeassistant/components/thermostat/heat_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
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

Expand Down Expand Up @@ -90,16 +91,18 @@ def __init__(self, hass, config, logger):
self.target_sensor_entity_id = config.get("target_sensor")

self.time_temp = []
for time_temp in list(config.get("time_temp").split(",")):
time, temp = time_temp.split(':')
time_start, time_end = time.split('-')
start_time = datetime.datetime.time(datetime.datetime.
strptime(time_start, '%H%M'))
end_time = datetime.datetime.time(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"))
if config.get("time_temp"):
for time_temp in list(config.get("time_temp").split(",")):
time, temp = time_temp.split(':')
time_start, time_end = time.split('-')
start_time = datetime.datetime.time(
datetime.datetime.strptime(time_start, '%H%M'))
end_time = datetime.datetime.time(
datetime.datetime.strptime(time_end, '%H%M'))
self.time_temp.append((start_time, end_time, float(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
Expand Down Expand Up @@ -178,7 +181,7 @@ def _heater_turned_on(self, entity_id, old_state, new_state):
if not self._heater_manual_changed:
pass
else:
self.set_temperature(100)
self.set_temperature(self.max_temp)

self._heater_manual_changed = True

Expand All @@ -194,3 +197,13 @@ def turn_away_mode_on(self):
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