Add sensor platform for vicare integration (heatpump) (#34385)

* Add sensor platform for vicare (heatpump)

* Formatting and fixes

* Formatting and fixes 2

* Fixes and formatting 3

* Fixes and formatting 4

* Add binary_sensor and more sensors

This moves some more climate attributes to sensors and adds
binary_sensors

* Move ActiveError back to climate component

The data returned by ActiveError is more complex.
It takes further investigation on how to interpret it a s a binary sensor.
Therefore it is moved back as an attribute of the climate component

* Update PyViCare library

* PR changes

* PR changes 2

Co-authored-by: Hans Oischinger <hans.oischinger@gmail.com>
This commit is contained in:
Martin 2020-06-13 21:53:42 +02:00 committed by GitHub
parent 0bfcb99c04
commit 0bbb56dd05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 424 additions and 21 deletions

View file

@ -19,6 +19,7 @@ from homeassistant.const import ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS
from . import (
DOMAIN as VICARE_DOMAIN,
PYVICARE_ERROR,
VICARE_API,
VICARE_HEATING_TYPE,
VICARE_NAME,
@ -77,8 +78,6 @@ HA_TO_VICARE_PRESET_HEATING = {
PRESET_ECO: VICARE_PROGRAM_ECO,
}
PYVICARE_ERROR = "error"
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Create the ViCare climate devices."""
@ -138,8 +137,6 @@ class ViCareClimate(ClimateEntity):
# Update the generic 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()
@ -150,25 +147,14 @@ class ViCareClimate(ClimateEntity):
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()
# Update the specific device attributes
if self._heating_type == HeatingType.gas:
self._current_action = self._api.getBurnerActive()
self._attributes["burner_modulation"] = self._api.getBurnerModulation()
self._attributes[
"boiler_temperature"
] = self._api.getBoilerTemperature()
elif self._heating_type == HeatingType.heatpump:
self._current_action = self._api.getCompressorActive()
self._attributes[
"return_temperature"
] = self._api.getReturnTemperature()
except requests.exceptions.ConnectionError:
_LOGGER.error("Unable to retrieve data from ViCare server")
except ValueError: