From 4ed1d9ba8eb37022db024efdf4cbd6e780dfe902 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Tue, 16 Apr 2019 23:37:27 +0200 Subject: [PATCH] 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 --- .../components/water_heater/__init__.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/homeassistant/components/water_heater/__init__.py b/homeassistant/components/water_heater/__init__.py index 6c3cc7405ba..2ecd2522559 100644 --- a/homeassistant/components/water_heater/__init__.py +++ b/homeassistant/components/water_heater/__init__.py @@ -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."""