Add translation keys to ViCare integration (#104425)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Christopher Fenner 2023-11-25 13:11:29 +01:00 committed by GitHub
parent 1cfbdd6a5d
commit 17cef8940f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 385 additions and 134 deletions

View File

@ -5,6 +5,7 @@ from contextlib import suppress
from dataclasses import dataclass from dataclasses import dataclass
import logging import logging
from PyViCare.PyViCareDevice import Device as PyViCareDevice
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
from PyViCare.PyViCareUtils import ( from PyViCare.PyViCareUtils import (
PyViCareInvalidDataError, PyViCareInvalidDataError,
@ -40,14 +41,14 @@ class ViCareBinarySensorEntityDescription(
CIRCUIT_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( CIRCUIT_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="circulationpump_active", key="circulationpump_active",
name="Circulation pump", translation_key="circulation_pump",
icon="mdi:pump", icon="mdi:pump",
device_class=BinarySensorDeviceClass.RUNNING, device_class=BinarySensorDeviceClass.RUNNING,
value_getter=lambda api: api.getCirculationPumpActive(), value_getter=lambda api: api.getCirculationPumpActive(),
), ),
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="frost_protection_active", key="frost_protection_active",
name="Frost protection", translation_key="frost_protection",
icon="mdi:snowflake", icon="mdi:snowflake",
value_getter=lambda api: api.getFrostProtectionActive(), value_getter=lambda api: api.getFrostProtectionActive(),
), ),
@ -56,7 +57,7 @@ CIRCUIT_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
BURNER_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( BURNER_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="burner_active", key="burner_active",
name="Burner", translation_key="burner",
icon="mdi:gas-burner", icon="mdi:gas-burner",
device_class=BinarySensorDeviceClass.RUNNING, device_class=BinarySensorDeviceClass.RUNNING,
value_getter=lambda api: api.getActive(), value_getter=lambda api: api.getActive(),
@ -66,7 +67,7 @@ BURNER_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
COMPRESSOR_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( COMPRESSOR_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="compressor_active", key="compressor_active",
name="Compressor", translation_key="compressor",
device_class=BinarySensorDeviceClass.RUNNING, device_class=BinarySensorDeviceClass.RUNNING,
value_getter=lambda api: api.getActive(), value_getter=lambda api: api.getActive(),
), ),
@ -75,27 +76,27 @@ COMPRESSOR_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="solar_pump_active", key="solar_pump_active",
name="Solar pump", translation_key="solar_pump",
icon="mdi:pump", icon="mdi:pump",
device_class=BinarySensorDeviceClass.RUNNING, device_class=BinarySensorDeviceClass.RUNNING,
value_getter=lambda api: api.getSolarPumpActive(), value_getter=lambda api: api.getSolarPumpActive(),
), ),
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="charging_active", key="charging_active",
name="DHW Charging", translation_key="domestic_hot_water_charging",
device_class=BinarySensorDeviceClass.RUNNING, device_class=BinarySensorDeviceClass.RUNNING,
value_getter=lambda api: api.getDomesticHotWaterChargingActive(), value_getter=lambda api: api.getDomesticHotWaterChargingActive(),
), ),
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="dhw_circulationpump_active", key="dhw_circulationpump_active",
name="DHW Circulation Pump", translation_key="domestic_hot_water_circulation_pump",
icon="mdi:pump", icon="mdi:pump",
device_class=BinarySensorDeviceClass.RUNNING, device_class=BinarySensorDeviceClass.RUNNING,
value_getter=lambda api: api.getDomesticHotWaterCirculationPumpActive(), value_getter=lambda api: api.getDomesticHotWaterCirculationPumpActive(),
), ),
ViCareBinarySensorEntityDescription( ViCareBinarySensorEntityDescription(
key="dhw_pump_active", key="dhw_pump_active",
name="DHW Pump", translation_key="domestic_hot_water_pump",
icon="mdi:pump", icon="mdi:pump",
device_class=BinarySensorDeviceClass.RUNNING, device_class=BinarySensorDeviceClass.RUNNING,
value_getter=lambda api: api.getDomesticHotWaterPumpActive(), value_getter=lambda api: api.getDomesticHotWaterPumpActive(),
@ -104,15 +105,13 @@ GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
def _build_entity( def _build_entity(
name: str, vicare_api: PyViCareDevice,
vicare_api,
device_config: PyViCareDeviceConfig, device_config: PyViCareDeviceConfig,
entity_description: ViCareBinarySensorEntityDescription, entity_description: ViCareBinarySensorEntityDescription,
): ):
"""Create a ViCare binary sensor entity.""" """Create a ViCare binary sensor entity."""
if is_supported(name, entity_description, vicare_api): if is_supported(entity_description.key, entity_description, vicare_api):
return ViCareBinarySensor( return ViCareBinarySensor(
name,
vicare_api, vicare_api,
device_config, device_config,
entity_description, entity_description,
@ -130,12 +129,8 @@ async def _entities_from_descriptions(
"""Create entities from descriptions and list of burners/circuits.""" """Create entities from descriptions and list of burners/circuits."""
for description in sensor_descriptions: for description in sensor_descriptions:
for current in iterables: for current in iterables:
suffix = ""
if len(iterables) > 1:
suffix = f" {current.id}"
entity = await hass.async_add_executor_job( entity = await hass.async_add_executor_job(
_build_entity, _build_entity,
f"{description.name}{suffix}",
current, current,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
description, description,
@ -157,7 +152,6 @@ async def async_setup_entry(
for description in GLOBAL_SENSORS: for description in GLOBAL_SENSORS:
entity = await hass.async_add_executor_job( entity = await hass.async_add_executor_job(
_build_entity, _build_entity,
description.name,
api, api,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
description, description,
@ -195,12 +189,14 @@ class ViCareBinarySensor(ViCareEntity, BinarySensorEntity):
entity_description: ViCareBinarySensorEntityDescription entity_description: ViCareBinarySensorEntityDescription
def __init__( def __init__(
self, name, api, device_config, description: ViCareBinarySensorEntityDescription self,
api: PyViCareDevice,
device_config: PyViCareDeviceConfig,
description: ViCareBinarySensorEntityDescription,
) -> None: ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(device_config, api, description.key) super().__init__(device_config, api, description.key)
self.entity_description = description self.entity_description = description
self._attr_name = name
@property @property
def available(self) -> bool: def available(self) -> bool:

View File

@ -5,6 +5,7 @@ from contextlib import suppress
from dataclasses import dataclass from dataclasses import dataclass
import logging import logging
from PyViCare.PyViCareDevice import Device as PyViCareDevice
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
from PyViCare.PyViCareUtils import ( from PyViCare.PyViCareUtils import (
PyViCareInvalidDataError, PyViCareInvalidDataError,
@ -26,8 +27,6 @@ from .utils import is_supported
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
BUTTON_DHW_ACTIVATE_ONETIME_CHARGE = "activate_onetimecharge"
@dataclass @dataclass
class ViCareButtonEntityDescription( class ViCareButtonEntityDescription(
@ -38,8 +37,8 @@ class ViCareButtonEntityDescription(
BUTTON_DESCRIPTIONS: tuple[ViCareButtonEntityDescription, ...] = ( BUTTON_DESCRIPTIONS: tuple[ViCareButtonEntityDescription, ...] = (
ViCareButtonEntityDescription( ViCareButtonEntityDescription(
key=BUTTON_DHW_ACTIVATE_ONETIME_CHARGE, key="activate_onetimecharge",
name="Activate one-time charge", translation_key="activate_onetimecharge",
icon="mdi:shower-head", icon="mdi:shower-head",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
value_getter=lambda api: api.getOneTimeCharge(), value_getter=lambda api: api.getOneTimeCharge(),
@ -49,16 +48,13 @@ BUTTON_DESCRIPTIONS: tuple[ViCareButtonEntityDescription, ...] = (
def _build_entity( def _build_entity(
name: str, vicare_api: PyViCareDevice,
vicare_api,
device_config: PyViCareDeviceConfig, device_config: PyViCareDeviceConfig,
entity_description: ViCareButtonEntityDescription, entity_description: ViCareButtonEntityDescription,
): ):
"""Create a ViCare button entity.""" """Create a ViCare button entity."""
_LOGGER.debug("Found device %s", name) if is_supported(entity_description.key, entity_description, vicare_api):
if is_supported(name, entity_description, vicare_api):
return ViCareButton( return ViCareButton(
name,
vicare_api, vicare_api,
device_config, device_config,
entity_description, entity_description,
@ -79,7 +75,6 @@ async def async_setup_entry(
for description in BUTTON_DESCRIPTIONS: for description in BUTTON_DESCRIPTIONS:
entity = await hass.async_add_executor_job( entity = await hass.async_add_executor_job(
_build_entity, _build_entity,
description.name,
api, api,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
description, description,
@ -96,7 +91,10 @@ class ViCareButton(ViCareEntity, ButtonEntity):
entity_description: ViCareButtonEntityDescription entity_description: ViCareButtonEntityDescription
def __init__( def __init__(
self, name, api, device_config, description: ViCareButtonEntityDescription self,
api: PyViCareDevice,
device_config: PyViCareDeviceConfig,
description: ViCareButtonEntityDescription,
) -> None: ) -> None:
"""Initialize the button.""" """Initialize the button."""
super().__init__(device_config, api, description.key) super().__init__(device_config, api, description.key)

View File

@ -5,6 +5,9 @@ from contextlib import suppress
import logging import logging
from typing import Any from typing import Any
from PyViCare.PyViCareDevice import Device as PyViCareDevice
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
from PyViCare.PyViCareHeatingDevice import HeatingCircuit as PyViCareHeatingCircuit
from PyViCare.PyViCareUtils import ( from PyViCare.PyViCareUtils import (
PyViCareCommandError, PyViCareCommandError,
PyViCareInvalidDataError, PyViCareInvalidDataError,
@ -107,18 +110,15 @@ async def async_setup_entry(
"""Set up the ViCare climate platform.""" """Set up the ViCare climate platform."""
entities = [] entities = []
api = hass.data[DOMAIN][config_entry.entry_id][VICARE_API] api = hass.data[DOMAIN][config_entry.entry_id][VICARE_API]
device_config = hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG]
circuits = await hass.async_add_executor_job(_get_circuits, api) circuits = await hass.async_add_executor_job(_get_circuits, api)
for circuit in circuits: for circuit in circuits:
suffix = ""
if len(circuits) > 1:
suffix = f" {circuit.id}"
entity = ViCareClimate( entity = ViCareClimate(
f"Heating{suffix}",
api, api,
circuit, circuit,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], device_config,
"heating",
) )
entities.append(entity) entities.append(entity)
@ -148,13 +148,19 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
_current_action: bool | None = None _current_action: bool | None = None
_current_mode: str | None = None _current_mode: str | None = None
def __init__(self, name, api, circuit, device_config) -> None: def __init__(
self,
api: PyViCareDevice,
circuit: PyViCareHeatingCircuit,
device_config: PyViCareDeviceConfig,
translation_key: str,
) -> None:
"""Initialize the climate device.""" """Initialize the climate device."""
super().__init__(device_config, api, circuit.id) super().__init__(device_config, api, circuit.id)
self._attr_name = name
self._circuit = circuit self._circuit = circuit
self._attributes: dict[str, Any] = {} self._attributes: dict[str, Any] = {}
self._current_program = None self._current_program = None
self._attr_translation_key = translation_key
def update(self) -> None: def update(self) -> None:
"""Let HA know there has been an update from the ViCare API.""" """Let HA know there has been an update from the ViCare API."""

View File

@ -43,7 +43,7 @@ class ViCareNumberEntityDescription(NumberEntityDescription, ViCareRequiredKeysM
CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = ( CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = (
ViCareNumberEntityDescription( ViCareNumberEntityDescription(
key="heating curve shift", key="heating curve shift",
name="Heating curve shift", translation_key="heating curve shift",
icon="mdi:plus-minus-variant", icon="mdi:plus-minus-variant",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
value_getter=lambda api: api.getHeatingCurveShift(), value_getter=lambda api: api.getHeatingCurveShift(),
@ -57,7 +57,7 @@ CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = (
), ),
ViCareNumberEntityDescription( ViCareNumberEntityDescription(
key="heating curve slope", key="heating curve slope",
name="Heating curve slope", translation_key="heating_curve_slope",
icon="mdi:slope-uphill", icon="mdi:slope-uphill",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
value_getter=lambda api: api.getHeatingCurveSlope(), value_getter=lambda api: api.getHeatingCurveSlope(),
@ -72,16 +72,13 @@ CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = (
def _build_entity( def _build_entity(
name: str,
vicare_api: PyViCareHeatingDeviceWithComponent, vicare_api: PyViCareHeatingDeviceWithComponent,
device_config: PyViCareDeviceConfig, device_config: PyViCareDeviceConfig,
entity_description: ViCareNumberEntityDescription, entity_description: ViCareNumberEntityDescription,
) -> ViCareNumber | None: ) -> ViCareNumber | None:
"""Create a ViCare number entity.""" """Create a ViCare number entity."""
_LOGGER.debug("Found device %s", name) if is_supported(entity_description.key, entity_description, vicare_api):
if is_supported(name, entity_description, vicare_api):
return ViCareNumber( return ViCareNumber(
name,
vicare_api, vicare_api,
device_config, device_config,
entity_description, entity_description,
@ -100,13 +97,9 @@ async def async_setup_entry(
entities: list[ViCareNumber] = [] entities: list[ViCareNumber] = []
try: try:
for circuit in api.circuits: for circuit in api.circuits:
suffix = ""
if len(api.circuits) > 1:
suffix = f" {circuit.id}"
for description in CIRCUIT_ENTITY_DESCRIPTIONS: for description in CIRCUIT_ENTITY_DESCRIPTIONS:
entity = await hass.async_add_executor_job( entity = await hass.async_add_executor_job(
_build_entity, _build_entity,
f"{description.name}{suffix}",
circuit, circuit,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
description, description,
@ -126,7 +119,6 @@ class ViCareNumber(ViCareEntity, NumberEntity):
def __init__( def __init__(
self, self,
name: str,
api: PyViCareHeatingDeviceWithComponent, api: PyViCareHeatingDeviceWithComponent,
device_config: PyViCareDeviceConfig, device_config: PyViCareDeviceConfig,
description: ViCareNumberEntityDescription, description: ViCareNumberEntityDescription,
@ -134,7 +126,6 @@ class ViCareNumber(ViCareEntity, NumberEntity):
"""Initialize the number.""" """Initialize the number."""
super().__init__(device_config, api, description.key) super().__init__(device_config, api, description.key)
self.entity_description = description self.entity_description = description
self._attr_name = name
@property @property
def available(self) -> bool: def available(self) -> bool:

View File

@ -65,7 +65,7 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="outside_temperature", key="outside_temperature",
name="Outside Temperature", translation_key="outside_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getOutsideTemperature(), value_getter=lambda api: api.getOutsideTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -73,7 +73,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="return_temperature", key="return_temperature",
name="Return Temperature", translation_key="return_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getReturnTemperature(), value_getter=lambda api: api.getReturnTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -81,7 +81,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="boiler_temperature", key="boiler_temperature",
name="Boiler Temperature", translation_key="boiler_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getBoilerTemperature(), value_getter=lambda api: api.getBoilerTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -89,7 +89,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="boiler_supply_temperature", key="boiler_supply_temperature",
name="Boiler Supply Temperature", translation_key="boiler_supply_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getBoilerCommonSupplyTemperature(), value_getter=lambda api: api.getBoilerCommonSupplyTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -97,7 +97,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="primary_circuit_supply_temperature", key="primary_circuit_supply_temperature",
name="Primary Circuit Supply Temperature", translation_key="primary_circuit_supply_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getSupplyTemperaturePrimaryCircuit(), value_getter=lambda api: api.getSupplyTemperaturePrimaryCircuit(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -105,7 +105,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="primary_circuit_return_temperature", key="primary_circuit_return_temperature",
name="Primary Circuit Return Temperature", translation_key="primary_circuit_return_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getReturnTemperaturePrimaryCircuit(), value_getter=lambda api: api.getReturnTemperaturePrimaryCircuit(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -113,7 +113,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="secondary_circuit_supply_temperature", key="secondary_circuit_supply_temperature",
name="Secondary Circuit Supply Temperature", translation_key="secondary_circuit_supply_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getSupplyTemperatureSecondaryCircuit(), value_getter=lambda api: api.getSupplyTemperatureSecondaryCircuit(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -121,7 +121,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="secondary_circuit_return_temperature", key="secondary_circuit_return_temperature",
name="Secondary Circuit Return Temperature", translation_key="secondary_circuit_return_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getReturnTemperatureSecondaryCircuit(), value_getter=lambda api: api.getReturnTemperatureSecondaryCircuit(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -129,7 +129,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_out_temperature", key="hotwater_out_temperature",
name="Hot Water Out Temperature", translation_key="hotwater_out_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getDomesticHotWaterOutletTemperature(), value_getter=lambda api: api.getDomesticHotWaterOutletTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -137,7 +137,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_max_temperature", key="hotwater_max_temperature",
name="Hot Water Max Temperature", translation_key="hotwater_max_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getDomesticHotWaterMaxTemperature(), value_getter=lambda api: api.getDomesticHotWaterMaxTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -145,7 +145,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_min_temperature", key="hotwater_min_temperature",
name="Hot Water Min Temperature", translation_key="hotwater_min_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getDomesticHotWaterMinTemperature(), value_getter=lambda api: api.getDomesticHotWaterMinTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -153,63 +153,63 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_consumption_today", key="hotwater_gas_consumption_today",
name="Hot water gas consumption today", translation_key="hotwater_gas_consumption_today",
value_getter=lambda api: api.getGasConsumptionDomesticHotWaterToday(), value_getter=lambda api: api.getGasConsumptionDomesticHotWaterToday(),
unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_consumption_heating_this_week", key="hotwater_gas_consumption_heating_this_week",
name="Hot water gas consumption this week", translation_key="hotwater_gas_consumption_heating_this_week",
value_getter=lambda api: api.getGasConsumptionDomesticHotWaterThisWeek(), value_getter=lambda api: api.getGasConsumptionDomesticHotWaterThisWeek(),
unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_consumption_heating_this_month", key="hotwater_gas_consumption_heating_this_month",
name="Hot water gas consumption this month", translation_key="hotwater_gas_consumption_heating_this_month",
value_getter=lambda api: api.getGasConsumptionDomesticHotWaterThisMonth(), value_getter=lambda api: api.getGasConsumptionDomesticHotWaterThisMonth(),
unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_consumption_heating_this_year", key="hotwater_gas_consumption_heating_this_year",
name="Hot water gas consumption this year", translation_key="hotwater_gas_consumption_heating_this_year",
value_getter=lambda api: api.getGasConsumptionDomesticHotWaterThisYear(), value_getter=lambda api: api.getGasConsumptionDomesticHotWaterThisYear(),
unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_consumption_heating_today", key="gas_consumption_heating_today",
name="Heating gas consumption today", translation_key="gas_consumption_heating_today",
value_getter=lambda api: api.getGasConsumptionHeatingToday(), value_getter=lambda api: api.getGasConsumptionHeatingToday(),
unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_consumption_heating_this_week", key="gas_consumption_heating_this_week",
name="Heating gas consumption this week", translation_key="gas_consumption_heating_this_week",
value_getter=lambda api: api.getGasConsumptionHeatingThisWeek(), value_getter=lambda api: api.getGasConsumptionHeatingThisWeek(),
unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_consumption_heating_this_month", key="gas_consumption_heating_this_month",
name="Heating gas consumption this month", translation_key="gas_consumption_heating_this_month",
value_getter=lambda api: api.getGasConsumptionHeatingThisMonth(), value_getter=lambda api: api.getGasConsumptionHeatingThisMonth(),
unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_consumption_heating_this_year", key="gas_consumption_heating_this_year",
name="Heating gas consumption this year", translation_key="gas_consumption_heating_this_year",
value_getter=lambda api: api.getGasConsumptionHeatingThisYear(), value_getter=lambda api: api.getGasConsumptionHeatingThisYear(),
unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_summary_consumption_heating_currentday", key="gas_summary_consumption_heating_currentday",
name="Heating gas consumption current day", translation_key="gas_summary_consumption_heating_currentday",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentDay(), value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentDay(),
unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(),
@ -217,7 +217,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_summary_consumption_heating_currentmonth", key="gas_summary_consumption_heating_currentmonth",
name="Heating gas consumption current month", translation_key="gas_summary_consumption_heating_currentmonth",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentMonth(), value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentMonth(),
unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(),
@ -225,7 +225,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_summary_consumption_heating_currentyear", key="gas_summary_consumption_heating_currentyear",
name="Heating gas consumption current year", translation_key="gas_summary_consumption_heating_currentyear",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentYear(), value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentYear(),
unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(),
@ -233,7 +233,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="gas_summary_consumption_heating_lastsevendays", key="gas_summary_consumption_heating_lastsevendays",
name="Heating gas consumption last seven days", translation_key="gas_summary_consumption_heating_lastsevendays",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionHeatingLastSevenDays(), value_getter=lambda api: api.getGasSummaryConsumptionHeatingLastSevenDays(),
unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(),
@ -241,7 +241,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_summary_consumption_heating_currentday", key="hotwater_gas_summary_consumption_heating_currentday",
name="Hot water gas consumption current day", translation_key="hotwater_gas_summary_consumption_heating_currentday",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentDay(), value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentDay(),
unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(),
@ -249,7 +249,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_summary_consumption_heating_currentmonth", key="hotwater_gas_summary_consumption_heating_currentmonth",
name="Hot water gas consumption current month", translation_key="hotwater_gas_summary_consumption_heating_currentmonth",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentMonth(), value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentMonth(),
unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(),
@ -257,7 +257,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_summary_consumption_heating_currentyear", key="hotwater_gas_summary_consumption_heating_currentyear",
name="Hot water gas consumption current year", translation_key="hotwater_gas_summary_consumption_heating_currentyear",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentYear(), value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentYear(),
unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(),
@ -265,7 +265,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="hotwater_gas_summary_consumption_heating_lastsevendays", key="hotwater_gas_summary_consumption_heating_lastsevendays",
name="Hot water gas consumption last seven days", translation_key="hotwater_gas_summary_consumption_heating_lastsevendays",
native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, native_unit_of_measurement=UnitOfVolume.CUBIC_METERS,
value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterLastSevenDays(), value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterLastSevenDays(),
unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(),
@ -273,7 +273,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_currentday", key="energy_summary_consumption_heating_currentday",
name="Energy consumption of gas heating current day", translation_key="energy_summary_consumption_heating_currentday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentDay(), value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentDay(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
@ -281,7 +281,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_currentmonth", key="energy_summary_consumption_heating_currentmonth",
name="Energy consumption of gas heating current month", translation_key="energy_summary_consumption_heating_currentmonth",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentMonth(), value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentMonth(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
@ -289,7 +289,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_currentyear", key="energy_summary_consumption_heating_currentyear",
name="Energy consumption of gas heating current year", translation_key="energy_summary_consumption_heating_currentyear",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentYear(), value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentYear(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
@ -297,7 +297,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_lastsevendays", key="energy_summary_consumption_heating_lastsevendays",
name="Energy consumption of gas heating last seven days", translation_key="energy_summary_consumption_heating_lastsevendays",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingLastSevenDays(), value_getter=lambda api: api.getPowerSummaryConsumptionHeatingLastSevenDays(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
@ -305,7 +305,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_dhw_summary_consumption_heating_currentday", key="energy_dhw_summary_consumption_heating_currentday",
name="Energy consumption of hot water gas heating current day", translation_key="energy_dhw_summary_consumption_heating_currentday",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentDay(), value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentDay(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
@ -313,7 +313,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_dhw_summary_consumption_heating_currentmonth", key="energy_dhw_summary_consumption_heating_currentmonth",
name="Energy consumption of hot water gas heating current month", translation_key="energy_dhw_summary_consumption_heating_currentmonth",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentMonth(), value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentMonth(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
@ -321,7 +321,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_dhw_summary_consumption_heating_currentyear", key="energy_dhw_summary_consumption_heating_currentyear",
name="Energy consumption of hot water gas heating current year", translation_key="energy_dhw_summary_consumption_heating_currentyear",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentYear(), value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentYear(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
@ -329,7 +329,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="energy_summary_dhw_consumption_heating_lastsevendays", key="energy_summary_dhw_consumption_heating_lastsevendays",
name="Energy consumption of hot water gas heating last seven days", translation_key="energy_summary_dhw_consumption_heating_lastsevendays",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterLastSevenDays(), value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterLastSevenDays(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
@ -337,7 +337,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power_production_current", key="power_production_current",
name="Power production current", translation_key="power_production_current",
native_unit_of_measurement=UnitOfPower.WATT, native_unit_of_measurement=UnitOfPower.WATT,
value_getter=lambda api: api.getPowerProductionCurrent(), value_getter=lambda api: api.getPowerProductionCurrent(),
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
@ -345,7 +345,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power_production_today", key="power_production_today",
name="Energy production today", translation_key="power_production_today",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerProductionToday(), value_getter=lambda api: api.getPowerProductionToday(),
device_class=SensorDeviceClass.ENERGY, device_class=SensorDeviceClass.ENERGY,
@ -353,7 +353,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power_production_this_week", key="power_production_this_week",
name="Energy production this week", translation_key="power_production_this_week",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerProductionThisWeek(), value_getter=lambda api: api.getPowerProductionThisWeek(),
device_class=SensorDeviceClass.ENERGY, device_class=SensorDeviceClass.ENERGY,
@ -361,7 +361,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power_production_this_month", key="power_production_this_month",
name="Energy production this month", translation_key="power_production_this_month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerProductionThisMonth(), value_getter=lambda api: api.getPowerProductionThisMonth(),
device_class=SensorDeviceClass.ENERGY, device_class=SensorDeviceClass.ENERGY,
@ -369,7 +369,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power_production_this_year", key="power_production_this_year",
name="Energy production this year", translation_key="power_production_this_year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerProductionThisYear(), value_getter=lambda api: api.getPowerProductionThisYear(),
device_class=SensorDeviceClass.ENERGY, device_class=SensorDeviceClass.ENERGY,
@ -377,7 +377,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="solar storage temperature", key="solar storage temperature",
name="Solar Storage Temperature", translation_key="solar_storage_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getSolarStorageTemperature(), value_getter=lambda api: api.getSolarStorageTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -385,7 +385,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="collector temperature", key="collector temperature",
name="Solar Collector Temperature", translation_key="collector_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getSolarCollectorTemperature(), value_getter=lambda api: api.getSolarCollectorTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -393,7 +393,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="solar power production today", key="solar power production today",
name="Solar energy production today", translation_key="solar_power_production_today",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProductionToday(), value_getter=lambda api: api.getSolarPowerProductionToday(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(), unit_getter=lambda api: api.getSolarPowerProductionUnit(),
@ -402,7 +402,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="solar power production this week", key="solar power production this week",
name="Solar energy production this week", translation_key="solar_power_production_this_week",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProductionThisWeek(), value_getter=lambda api: api.getSolarPowerProductionThisWeek(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(), unit_getter=lambda api: api.getSolarPowerProductionUnit(),
@ -411,7 +411,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="solar power production this month", key="solar power production this month",
name="Solar energy production this month", translation_key="solar_power_production_this_month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProductionThisMonth(), value_getter=lambda api: api.getSolarPowerProductionThisMonth(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(), unit_getter=lambda api: api.getSolarPowerProductionUnit(),
@ -420,7 +420,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="solar power production this year", key="solar power production this year",
name="Solar energy production this year", translation_key="solar_power_production_this_year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getSolarPowerProductionThisYear(), value_getter=lambda api: api.getSolarPowerProductionThisYear(),
unit_getter=lambda api: api.getSolarPowerProductionUnit(), unit_getter=lambda api: api.getSolarPowerProductionUnit(),
@ -429,7 +429,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power consumption today", key="power consumption today",
name="Energy consumption today", translation_key="power_consumption_today",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionToday(), value_getter=lambda api: api.getPowerConsumptionToday(),
unit_getter=lambda api: api.getPowerConsumptionUnit(), unit_getter=lambda api: api.getPowerConsumptionUnit(),
@ -438,7 +438,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power consumption this week", key="power consumption this week",
name="Power consumption this week", translation_key="power_consumption_this_week",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionThisWeek(), value_getter=lambda api: api.getPowerConsumptionThisWeek(),
unit_getter=lambda api: api.getPowerConsumptionUnit(), unit_getter=lambda api: api.getPowerConsumptionUnit(),
@ -447,7 +447,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power consumption this month", key="power consumption this month",
name="Energy consumption this month", translation_key="power consumption this month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionThisMonth(), value_getter=lambda api: api.getPowerConsumptionThisMonth(),
unit_getter=lambda api: api.getPowerConsumptionUnit(), unit_getter=lambda api: api.getPowerConsumptionUnit(),
@ -456,7 +456,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="power consumption this year", key="power consumption this year",
name="Energy consumption this year", translation_key="power_consumption_this_year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerConsumptionThisYear(), value_getter=lambda api: api.getPowerConsumptionThisYear(),
unit_getter=lambda api: api.getPowerConsumptionUnit(), unit_getter=lambda api: api.getPowerConsumptionUnit(),
@ -465,7 +465,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="buffer top temperature", key="buffer top temperature",
name="Buffer top temperature", translation_key="buffer_top_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getBufferTopTemperature(), value_getter=lambda api: api.getBufferTopTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -473,7 +473,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="buffer main temperature", key="buffer main temperature",
name="Buffer main temperature", translation_key="buffer_main_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getBufferMainTemperature(), value_getter=lambda api: api.getBufferMainTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -481,7 +481,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="volumetric_flow", key="volumetric_flow",
name="Volumetric flow", translation_key="volumetric_flow",
icon="mdi:gauge", icon="mdi:gauge",
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
value_getter=lambda api: api.getVolumetricFlowReturn() / 1000, value_getter=lambda api: api.getVolumetricFlowReturn() / 1000,
@ -493,7 +493,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="supply_temperature", key="supply_temperature",
name="Supply Temperature", translation_key="supply_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getSupplyTemperature(), value_getter=lambda api: api.getSupplyTemperature(),
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
@ -504,14 +504,14 @@ CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="burner_starts", key="burner_starts",
name="Burner Starts", translation_key="burner_starts",
icon="mdi:counter", icon="mdi:counter",
value_getter=lambda api: api.getStarts(), value_getter=lambda api: api.getStarts(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="burner_hours", key="burner_hours",
name="Burner Hours", translation_key="burner_hours",
icon="mdi:counter", icon="mdi:counter",
native_unit_of_measurement=UnitOfTime.HOURS, native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHours(), value_getter=lambda api: api.getHours(),
@ -519,7 +519,7 @@ BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="burner_modulation", key="burner_modulation",
name="Burner Modulation", translation_key="burner_modulation",
icon="mdi:percent", icon="mdi:percent",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
value_getter=lambda api: api.getModulation(), value_getter=lambda api: api.getModulation(),
@ -530,14 +530,14 @@ BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_starts", key="compressor_starts",
name="Compressor Starts", translation_key="compressor_starts",
icon="mdi:counter", icon="mdi:counter",
value_getter=lambda api: api.getStarts(), value_getter=lambda api: api.getStarts(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_hours", key="compressor_hours",
name="Compressor Hours", translation_key="compressor_hours",
icon="mdi:counter", icon="mdi:counter",
native_unit_of_measurement=UnitOfTime.HOURS, native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHours(), value_getter=lambda api: api.getHours(),
@ -545,7 +545,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_hours_loadclass1", key="compressor_hours_loadclass1",
name="Compressor Hours Load Class 1", translation_key="compressor_hours_loadclass1",
icon="mdi:counter", icon="mdi:counter",
native_unit_of_measurement=UnitOfTime.HOURS, native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHoursLoadClass1(), value_getter=lambda api: api.getHoursLoadClass1(),
@ -553,7 +553,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_hours_loadclass2", key="compressor_hours_loadclass2",
name="Compressor Hours Load Class 2", translation_key="compressor_hours_loadclass2",
icon="mdi:counter", icon="mdi:counter",
native_unit_of_measurement=UnitOfTime.HOURS, native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHoursLoadClass2(), value_getter=lambda api: api.getHoursLoadClass2(),
@ -561,7 +561,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_hours_loadclass3", key="compressor_hours_loadclass3",
name="Compressor Hours Load Class 3", translation_key="compressor_hours_loadclass3",
icon="mdi:counter", icon="mdi:counter",
native_unit_of_measurement=UnitOfTime.HOURS, native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHoursLoadClass3(), value_getter=lambda api: api.getHoursLoadClass3(),
@ -569,7 +569,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_hours_loadclass4", key="compressor_hours_loadclass4",
name="Compressor Hours Load Class 4", translation_key="compressor_hours_loadclass4",
icon="mdi:counter", icon="mdi:counter",
native_unit_of_measurement=UnitOfTime.HOURS, native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHoursLoadClass4(), value_getter=lambda api: api.getHoursLoadClass4(),
@ -577,7 +577,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_hours_loadclass5", key="compressor_hours_loadclass5",
name="Compressor Hours Load Class 5", translation_key="compressor_hours_loadclass5",
icon="mdi:counter", icon="mdi:counter",
native_unit_of_measurement=UnitOfTime.HOURS, native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHoursLoadClass5(), value_getter=lambda api: api.getHoursLoadClass5(),
@ -585,7 +585,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
), ),
ViCareSensorEntityDescription( ViCareSensorEntityDescription(
key="compressor_phase", key="compressor_phase",
name="Compressor Phase", translation_key="compressor_phase",
icon="mdi:information", icon="mdi:information",
value_getter=lambda api: api.getPhase(), value_getter=lambda api: api.getPhase(),
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
@ -594,16 +594,13 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
def _build_entity( def _build_entity(
name: str,
vicare_api, vicare_api,
device_config: PyViCareDeviceConfig, device_config: PyViCareDeviceConfig,
entity_description: ViCareSensorEntityDescription, entity_description: ViCareSensorEntityDescription,
): ):
"""Create a ViCare sensor entity.""" """Create a ViCare sensor entity."""
_LOGGER.debug("Found device %s", name) if is_supported(entity_description.key, entity_description, vicare_api):
if is_supported(name, entity_description, vicare_api):
return ViCareSensor( return ViCareSensor(
name,
vicare_api, vicare_api,
device_config, device_config,
entity_description, entity_description,
@ -621,12 +618,8 @@ async def _entities_from_descriptions(
"""Create entities from descriptions and list of burners/circuits.""" """Create entities from descriptions and list of burners/circuits."""
for description in sensor_descriptions: for description in sensor_descriptions:
for current in iterables: for current in iterables:
suffix = ""
if len(iterables) > 1:
suffix = f" {current.id}"
entity = await hass.async_add_executor_job( entity = await hass.async_add_executor_job(
_build_entity, _build_entity,
f"{description.name}{suffix}",
current, current,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
description, description,
@ -647,7 +640,6 @@ async def async_setup_entry(
for description in GLOBAL_SENSORS: for description in GLOBAL_SENSORS:
entity = await hass.async_add_executor_job( entity = await hass.async_add_executor_job(
_build_entity, _build_entity,
description.name,
api, api,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
description, description,
@ -685,12 +677,14 @@ class ViCareSensor(ViCareEntity, SensorEntity):
entity_description: ViCareSensorEntityDescription entity_description: ViCareSensorEntityDescription
def __init__( def __init__(
self, name, api, device_config, description: ViCareSensorEntityDescription self,
api,
device_config: PyViCareDeviceConfig,
description: ViCareSensorEntityDescription,
) -> None: ) -> None:
"""Initialize the sensor.""" """Initialize the sensor."""
super().__init__(device_config, api, description.key) super().__init__(device_config, api, description.key)
self.entity_description = description self.entity_description = description
self._attr_name = name
@property @property
def available(self) -> bool: def available(self) -> bool:

View File

@ -28,6 +28,266 @@
"unknown": "[%key:common::config_flow::error::unknown%]" "unknown": "[%key:common::config_flow::error::unknown%]"
} }
}, },
"entity": {
"binary_sensor": {
"circulation_pump": {
"name": "Circulation pump"
},
"frost_protection": {
"name": "Frost protection"
},
"burner": {
"name": "Burner"
},
"compressor": {
"name": "Compressor"
},
"solar_pump": {
"name": "Solar pump"
},
"domestic_hot_water_charging": {
"name": "DHW charging"
},
"domestic_hot_water_circulation_pump": {
"name": "DHW circulation pump"
},
"domestic_hot_water_pump": {
"name": "DHW pump"
}
},
"button": {
"activate_onetimecharge": {
"name": "Activate one-time charge"
}
},
"climate": {
"heating": {
"name": "Heating"
}
},
"number": {
"heating_curve_shift": {
"name": "Heating curve shift"
},
"heating_curve_slope": {
"name": "Heating curve slope"
},
"normal_temperature": {
"name": "Normal temperature"
},
"reduced_temperature": {
"name": "Reduced temperature"
},
"comfort_temperature": {
"name": "Comfort temperature"
},
"eco_temperature": {
"name": "Eco temperature"
}
},
"sensor": {
"outside_temperature": {
"name": "Outside temperature"
},
"return_temperature": {
"name": "Return temperature"
},
"boiler_temperature": {
"name": "Boiler temperature"
},
"boiler_supply_temperature": {
"name": "Boiler supply temperature"
},
"primary_circuit_supply_temperature": {
"name": "Primary circuit supply temperature"
},
"primary_circuit_return_temperature": {
"name": "Primary circuit return temperature"
},
"secondary_circuit_supply_temperature": {
"name": "Secondary circuit supply temperature"
},
"secondary_circuit_return_temperature": {
"name": "Secondary circuit return temperature"
},
"hotwater_out_temperature": {
"name": "DHW out temperature"
},
"hotwater_max_temperature": {
"name": "DHW max temperature"
},
"hotwater_min_temperature": {
"name": "DHW min temperature"
},
"hotwater_gas_consumption_today": {
"name": "DHW gas consumption today"
},
"hotwater_gas_consumption_heating_this_week": {
"name": "DHW gas consumption this week"
},
"hotwater_gas_consumption_heating_this_month": {
"name": "DHW gas consumption this month"
},
"hotwater_gas_consumption_heating_this_year": {
"name": "DHW gas consumption this year"
},
"gas_consumption_heating_today": {
"name": "Heating gas consumption today"
},
"gas_consumption_heating_this_week": {
"name": "Heating gas consumption this week"
},
"gas_consumption_heating_this_month": {
"name": "Heating gas consumption this month"
},
"gas_consumption_heating_this_year": {
"name": "Heating gas consumption this year"
},
"gas_summary_consumption_heating_currentday": {
"name": "Heating gas consumption current day"
},
"gas_summary_consumption_heating_currentmonth": {
"name": "Heating gas consumption current month"
},
"gas_summary_consumption_heating_currentyear": {
"name": "Heating gas consumption current year"
},
"gas_summary_consumption_heating_lastsevendays": {
"name": "Heating gas consumption last seven days"
},
"hotwater_gas_summary_consumption_heating_currentday": {
"name": "DHW gas consumption current day"
},
"hotwater_gas_summary_consumption_heating_currentmonth": {
"name": "DHW gas consumption current month"
},
"hotwater_gas_summary_consumption_heating_currentyear": {
"name": "DHW gas consumption current year"
},
"hotwater_gas_summary_consumption_heating_lastsevendays": {
"name": "DHW gas consumption last seven days"
},
"energy_summary_consumption_heating_currentday": {
"name": "Energy consumption of gas heating current day"
},
"energy_summary_consumption_heating_currentmonth": {
"name": "Energy consumption of gas heating current month"
},
"energy_summary_consumption_heating_currentyear": {
"name": "Energy consumption of gas heating current year"
},
"energy_summary_consumption_heating_lastsevendays": {
"name": "Energy consumption of gas heating last seven days"
},
"energy_dhw_summary_consumption_heating_currentday": {
"name": "Energy consumption of hot water gas heating current day"
},
"energy_dhw_summary_consumption_heating_currentmonth": {
"name": "Energy consumption of hot water gas heating current month"
},
"energy_dhw_summary_consumption_heating_currentyear": {
"name": "Energy consumption of hot water gas heating current year"
},
"energy_summary_dhw_consumption_heating_lastsevendays": {
"name": "Energy consumption of hot water gas heating last seven days"
},
"power_production_current": {
"name": "Power production current"
},
"power_production_today": {
"name": "Energy production today"
},
"power_production_this_week": {
"name": "Energy production this week"
},
"power_production_this_month": {
"name": "Energy production this month"
},
"power_production_this_year": {
"name": "Energy production this year"
},
"solar_storage_temperature": {
"name": "Solar storage temperature"
},
"collector_temperature": {
"name": "Solar collector temperature"
},
"solar_power_production_today": {
"name": "Solar energy production today"
},
"solar_power_production_this_week": {
"name": "Solar energy production this week"
},
"solar_power_production_this_month": {
"name": "Solar energy production this month"
},
"solar_power_production_this_year": {
"name": "Solar energy production this year"
},
"power_consumption_today": {
"name": "Energy consumption today"
},
"power_consumption_this_week": {
"name": "Power consumption this week"
},
"power_consumption_this_month": {
"name": "Energy consumption this month"
},
"power_consumption_this_year": {
"name": "Energy consumption this year"
},
"buffer_top_temperature": {
"name": "Buffer top temperature"
},
"buffer_main_temperature": {
"name": "Buffer main temperature"
},
"volumetric_flow": {
"name": "Volumetric flow"
},
"supply_temperature": {
"name": "Supply temperature"
},
"burner_starts": {
"name": "Burner starts"
},
"burner_hours": {
"name": "Burner hours"
},
"burner_modulation": {
"name": "Burner modulation"
},
"compressor_starts": {
"name": "Compressor starts"
},
"compressor_hours": {
"name": "Compressor hours"
},
"compressor_hours_loadclass1": {
"name": "Compressor hours load class 1"
},
"compressor_hours_loadclass2": {
"name": "Compressor hours load class 2"
},
"compressor_hours_loadclass3": {
"name": "Compressor hours load class 3"
},
"compressor_hours_loadclass4": {
"name": "Compressor hours load class 4"
},
"compressor_hours_loadclass5": {
"name": "Compressor hours load class 5"
},
"compressor_phase": {
"name": "Compressor phase"
}
},
"water_heater": {
"water": {
"name": "Water"
}
}
},
"services": { "services": {
"set_vicare_mode": { "set_vicare_mode": {
"name": "Set ViCare mode", "name": "Set ViCare mode",

View File

@ -3,6 +3,9 @@ from contextlib import suppress
import logging import logging
from typing import Any from typing import Any
from PyViCare.PyViCareDevice import Device as PyViCareDevice
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
from PyViCare.PyViCareHeatingDevice import HeatingCircuit as PyViCareHeatingCircuit
from PyViCare.PyViCareUtils import ( from PyViCare.PyViCareUtils import (
PyViCareInvalidDataError, PyViCareInvalidDataError,
PyViCareNotSupportedFeatureError, PyViCareNotSupportedFeatureError,
@ -71,18 +74,15 @@ async def async_setup_entry(
"""Set up the ViCare climate platform.""" """Set up the ViCare climate platform."""
entities = [] entities = []
api = hass.data[DOMAIN][config_entry.entry_id][VICARE_API] api = hass.data[DOMAIN][config_entry.entry_id][VICARE_API]
device_config = hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG]
circuits = await hass.async_add_executor_job(_get_circuits, api) circuits = await hass.async_add_executor_job(_get_circuits, api)
for circuit in circuits: for circuit in circuits:
suffix = ""
if len(circuits) > 1:
suffix = f" {circuit.id}"
entity = ViCareWater( entity = ViCareWater(
f"Water{suffix}",
api, api,
circuit, circuit,
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], device_config,
"water",
) )
entities.append(entity) entities.append(entity)
@ -99,13 +99,19 @@ class ViCareWater(ViCareEntity, WaterHeaterEntity):
_attr_max_temp = VICARE_TEMP_WATER_MAX _attr_max_temp = VICARE_TEMP_WATER_MAX
_attr_operation_list = list(HA_TO_VICARE_HVAC_DHW) _attr_operation_list = list(HA_TO_VICARE_HVAC_DHW)
def __init__(self, name, api, circuit, device_config) -> None: def __init__(
self,
api: PyViCareDevice,
circuit: PyViCareHeatingCircuit,
device_config: PyViCareDeviceConfig,
translation_key: str,
) -> None:
"""Initialize the DHW water_heater device.""" """Initialize the DHW water_heater device."""
super().__init__(device_config, api, circuit.id) super().__init__(device_config, api, circuit.id)
self._attr_name = name
self._circuit = circuit self._circuit = circuit
self._attributes: dict[str, Any] = {} self._attributes: dict[str, Any] = {}
self._current_mode = None self._current_mode = None
self._attr_translation_key = translation_key
def update(self) -> None: def update(self) -> None:
"""Let HA know there has been an update from the ViCare API.""" """Let HA know there has been an update from the ViCare API."""