From 051639b6ad5113b431c7887d8a2e756bb57171b8 Mon Sep 17 00:00:00 2001 From: Hans Oischinger Date: Mon, 9 Sep 2019 23:46:11 +0200 Subject: [PATCH] Add more attributes to vicare climate entity (#26521) Add some device information as attributes to the climate device: - room_temperature - supply_temperature - outside_temperature - active_vicare_program - active_vicare_mode - heating_curve_slope - heating_curve_shift - month_since_last_service - date_last_service - error_history - active_error - circulationpump_active --- homeassistant/components/vicare/climate.py | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/homeassistant/components/vicare/climate.py b/homeassistant/components/vicare/climate.py index 1a5098360cf..7010f943707 100644 --- a/homeassistant/components/vicare/climate.py +++ b/homeassistant/components/vicare/climate.py @@ -88,6 +88,7 @@ class ViCareClimate(ClimateDevice): self._name = name self._state = None self._api = api + self._attributes = {} self._target_temperature = None self._current_mode = None self._current_temperature = None @@ -114,6 +115,25 @@ class ViCareClimate(ClimateDevice): self._current_mode = self._api.getActiveMode() + # Update the device attributes + self._attributes = {} + self._attributes["room_temperature"] = _room_temperature + self._attributes["supply_temperature"] = _supply_temperature + self._attributes["outside_temperature"] = self._api.getOutsideTemperature() + self._attributes["active_vicare_program"] = self._current_program + self._attributes["active_vicare_mode"] = self._current_mode + self._attributes["heating_curve_slope"] = self._api.getHeatingCurveSlope() + self._attributes["heating_curve_shift"] = self._api.getHeatingCurveShift() + self._attributes[ + "month_since_last_service" + ] = self._api.getMonthSinceLastService() + self._attributes["date_last_service"] = self._api.getLastServiceDate() + self._attributes["error_history"] = self._api.getErrorHistory() + self._attributes["active_error"] = self._api.getActiveError() + self._attributes[ + "circulationpump_active" + ] = self._api.getCirculationPumpActive() + @property def supported_features(self): """Return the list of supported features.""" @@ -208,3 +228,8 @@ class ViCareClimate(ClimateDevice): _LOGGER.debug("Setting preset to %s / %s", preset_mode, vicare_program) self._api.deactivateProgram(self._current_program) self._api.activateProgram(vicare_program) + + @property + def device_state_attributes(self): + """Show Device Attributes.""" + return self._attributes