Add target_temp_high/low and current_temperature (#21393)

* Add target_temp_high/low and current_temperature

water_heater piggy back on climate(thermostat) component in gui,
so these things are already supported by frontend for display
purposes.

* Drop support tags for target high/low
This commit is contained in:
Joakim Plate 2019-04-16 23:37:27 +02:00 committed by Paulus Schoutsen
parent d7183d642e
commit 4ed1d9ba8e

View File

@ -45,6 +45,9 @@ ATTR_MIN_TEMP = 'min_temp'
ATTR_AWAY_MODE = 'away_mode'
ATTR_OPERATION_MODE = 'operation_mode'
ATTR_OPERATION_LIST = 'operation_list'
ATTR_TARGET_TEMP_HIGH = 'target_temp_high'
ATTR_TARGET_TEMP_LOW = 'target_temp_low'
ATTR_CURRENT_TEMPERATURE = 'current_temperature'
CONVERTIBLE_ATTRIBUTE = [
ATTR_TEMPERATURE,
@ -132,6 +135,9 @@ class WaterHeaterDevice(Entity):
def state_attributes(self):
"""Return the optional state attributes."""
data = {
ATTR_CURRENT_TEMPERATURE: show_temp(
self.hass, self.current_temperature, self.temperature_unit,
self.precision),
ATTR_MIN_TEMP: show_temp(
self.hass, self.min_temp, self.temperature_unit,
self.precision),
@ -141,6 +147,12 @@ class WaterHeaterDevice(Entity):
ATTR_TEMPERATURE: show_temp(
self.hass, self.target_temperature, self.temperature_unit,
self.precision),
ATTR_TARGET_TEMP_HIGH: show_temp(
self.hass, self.target_temperature_high, self.temperature_unit,
self.precision),
ATTR_TARGET_TEMP_LOW: show_temp(
self.hass, self.target_temperature_low, self.temperature_unit,
self.precision),
}
supported_features = self.supported_features
@ -171,11 +183,26 @@ class WaterHeaterDevice(Entity):
"""Return the list of available operation modes."""
return None
@property
def current_temperature(self):
"""Return the current temperature."""
return None
@property
def target_temperature(self):
"""Return the temperature we try to reach."""
return None
@property
def target_temperature_high(self):
"""Return the highbound target temperature we try to reach."""
return None
@property
def target_temperature_low(self):
"""Return the lowbound target temperature we try to reach."""
return None
@property
def is_away_mode_on(self):
"""Return true if away mode is on."""