diff --git a/homeassistant/components/vicare/binary_sensor.py b/homeassistant/components/vicare/binary_sensor.py index 9e9f133b730..e9e379f45f2 100644 --- a/homeassistant/components/vicare/binary_sensor.py +++ b/homeassistant/components/vicare/binary_sensor.py @@ -5,6 +5,7 @@ from contextlib import suppress from dataclasses import dataclass import logging +from PyViCare.PyViCareDevice import Device as PyViCareDevice from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig from PyViCare.PyViCareUtils import ( PyViCareInvalidDataError, @@ -40,14 +41,14 @@ class ViCareBinarySensorEntityDescription( CIRCUIT_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="circulationpump_active", - name="Circulation pump", + translation_key="circulation_pump", icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getCirculationPumpActive(), ), ViCareBinarySensorEntityDescription( key="frost_protection_active", - name="Frost protection", + translation_key="frost_protection", icon="mdi:snowflake", value_getter=lambda api: api.getFrostProtectionActive(), ), @@ -56,7 +57,7 @@ CIRCUIT_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( BURNER_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="burner_active", - name="Burner", + translation_key="burner", icon="mdi:gas-burner", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getActive(), @@ -66,7 +67,7 @@ BURNER_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( COMPRESSOR_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="compressor_active", - name="Compressor", + translation_key="compressor", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getActive(), ), @@ -75,27 +76,27 @@ COMPRESSOR_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( ViCareBinarySensorEntityDescription( key="solar_pump_active", - name="Solar pump", + translation_key="solar_pump", icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getSolarPumpActive(), ), ViCareBinarySensorEntityDescription( key="charging_active", - name="DHW Charging", + translation_key="domestic_hot_water_charging", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getDomesticHotWaterChargingActive(), ), ViCareBinarySensorEntityDescription( key="dhw_circulationpump_active", - name="DHW Circulation Pump", + translation_key="domestic_hot_water_circulation_pump", icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getDomesticHotWaterCirculationPumpActive(), ), ViCareBinarySensorEntityDescription( key="dhw_pump_active", - name="DHW Pump", + translation_key="domestic_hot_water_pump", icon="mdi:pump", device_class=BinarySensorDeviceClass.RUNNING, value_getter=lambda api: api.getDomesticHotWaterPumpActive(), @@ -104,15 +105,13 @@ GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = ( def _build_entity( - name: str, - vicare_api, + vicare_api: PyViCareDevice, device_config: PyViCareDeviceConfig, entity_description: ViCareBinarySensorEntityDescription, ): """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( - name, vicare_api, device_config, entity_description, @@ -130,12 +129,8 @@ async def _entities_from_descriptions( """Create entities from descriptions and list of burners/circuits.""" for description in sensor_descriptions: for current in iterables: - suffix = "" - if len(iterables) > 1: - suffix = f" {current.id}" entity = await hass.async_add_executor_job( _build_entity, - f"{description.name}{suffix}", current, hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], description, @@ -157,7 +152,6 @@ async def async_setup_entry( for description in GLOBAL_SENSORS: entity = await hass.async_add_executor_job( _build_entity, - description.name, api, hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], description, @@ -195,12 +189,14 @@ class ViCareBinarySensor(ViCareEntity, BinarySensorEntity): entity_description: ViCareBinarySensorEntityDescription def __init__( - self, name, api, device_config, description: ViCareBinarySensorEntityDescription + self, + api: PyViCareDevice, + device_config: PyViCareDeviceConfig, + description: ViCareBinarySensorEntityDescription, ) -> None: """Initialize the sensor.""" super().__init__(device_config, api, description.key) self.entity_description = description - self._attr_name = name @property def available(self) -> bool: diff --git a/homeassistant/components/vicare/button.py b/homeassistant/components/vicare/button.py index 5ea6cf5edae..54b183bcc33 100644 --- a/homeassistant/components/vicare/button.py +++ b/homeassistant/components/vicare/button.py @@ -5,6 +5,7 @@ from contextlib import suppress from dataclasses import dataclass import logging +from PyViCare.PyViCareDevice import Device as PyViCareDevice from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig from PyViCare.PyViCareUtils import ( PyViCareInvalidDataError, @@ -26,8 +27,6 @@ from .utils import is_supported _LOGGER = logging.getLogger(__name__) -BUTTON_DHW_ACTIVATE_ONETIME_CHARGE = "activate_onetimecharge" - @dataclass class ViCareButtonEntityDescription( @@ -38,8 +37,8 @@ class ViCareButtonEntityDescription( BUTTON_DESCRIPTIONS: tuple[ViCareButtonEntityDescription, ...] = ( ViCareButtonEntityDescription( - key=BUTTON_DHW_ACTIVATE_ONETIME_CHARGE, - name="Activate one-time charge", + key="activate_onetimecharge", + translation_key="activate_onetimecharge", icon="mdi:shower-head", entity_category=EntityCategory.CONFIG, value_getter=lambda api: api.getOneTimeCharge(), @@ -49,16 +48,13 @@ BUTTON_DESCRIPTIONS: tuple[ViCareButtonEntityDescription, ...] = ( def _build_entity( - name: str, - vicare_api, + vicare_api: PyViCareDevice, device_config: PyViCareDeviceConfig, entity_description: ViCareButtonEntityDescription, ): """Create a ViCare button entity.""" - _LOGGER.debug("Found device %s", name) - if is_supported(name, entity_description, vicare_api): + if is_supported(entity_description.key, entity_description, vicare_api): return ViCareButton( - name, vicare_api, device_config, entity_description, @@ -79,7 +75,6 @@ async def async_setup_entry( for description in BUTTON_DESCRIPTIONS: entity = await hass.async_add_executor_job( _build_entity, - description.name, api, hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], description, @@ -96,7 +91,10 @@ class ViCareButton(ViCareEntity, ButtonEntity): entity_description: ViCareButtonEntityDescription def __init__( - self, name, api, device_config, description: ViCareButtonEntityDescription + self, + api: PyViCareDevice, + device_config: PyViCareDeviceConfig, + description: ViCareButtonEntityDescription, ) -> None: """Initialize the button.""" super().__init__(device_config, api, description.key) diff --git a/homeassistant/components/vicare/climate.py b/homeassistant/components/vicare/climate.py index 0c145e5e5a8..fa41242036a 100644 --- a/homeassistant/components/vicare/climate.py +++ b/homeassistant/components/vicare/climate.py @@ -5,6 +5,9 @@ from contextlib import suppress import logging 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 ( PyViCareCommandError, PyViCareInvalidDataError, @@ -107,18 +110,15 @@ async def async_setup_entry( """Set up the ViCare climate platform.""" entities = [] 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) for circuit in circuits: - suffix = "" - if len(circuits) > 1: - suffix = f" {circuit.id}" - entity = ViCareClimate( - f"Heating{suffix}", api, circuit, - hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], + device_config, + "heating", ) entities.append(entity) @@ -148,13 +148,19 @@ class ViCareClimate(ViCareEntity, ClimateEntity): _current_action: bool | 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.""" super().__init__(device_config, api, circuit.id) - self._attr_name = name self._circuit = circuit self._attributes: dict[str, Any] = {} self._current_program = None + self._attr_translation_key = translation_key def update(self) -> None: """Let HA know there has been an update from the ViCare API.""" diff --git a/homeassistant/components/vicare/number.py b/homeassistant/components/vicare/number.py index 17017d00def..c5d800cd4ac 100644 --- a/homeassistant/components/vicare/number.py +++ b/homeassistant/components/vicare/number.py @@ -43,7 +43,7 @@ class ViCareNumberEntityDescription(NumberEntityDescription, ViCareRequiredKeysM CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = ( ViCareNumberEntityDescription( key="heating curve shift", - name="Heating curve shift", + translation_key="heating curve shift", icon="mdi:plus-minus-variant", entity_category=EntityCategory.CONFIG, value_getter=lambda api: api.getHeatingCurveShift(), @@ -57,7 +57,7 @@ CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = ( ), ViCareNumberEntityDescription( key="heating curve slope", - name="Heating curve slope", + translation_key="heating_curve_slope", icon="mdi:slope-uphill", entity_category=EntityCategory.CONFIG, value_getter=lambda api: api.getHeatingCurveSlope(), @@ -72,16 +72,13 @@ CIRCUIT_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = ( def _build_entity( - name: str, vicare_api: PyViCareHeatingDeviceWithComponent, device_config: PyViCareDeviceConfig, entity_description: ViCareNumberEntityDescription, ) -> ViCareNumber | None: """Create a ViCare number entity.""" - _LOGGER.debug("Found device %s", name) - if is_supported(name, entity_description, vicare_api): + if is_supported(entity_description.key, entity_description, vicare_api): return ViCareNumber( - name, vicare_api, device_config, entity_description, @@ -100,13 +97,9 @@ async def async_setup_entry( entities: list[ViCareNumber] = [] try: for circuit in api.circuits: - suffix = "" - if len(api.circuits) > 1: - suffix = f" {circuit.id}" for description in CIRCUIT_ENTITY_DESCRIPTIONS: entity = await hass.async_add_executor_job( _build_entity, - f"{description.name}{suffix}", circuit, hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], description, @@ -126,7 +119,6 @@ class ViCareNumber(ViCareEntity, NumberEntity): def __init__( self, - name: str, api: PyViCareHeatingDeviceWithComponent, device_config: PyViCareDeviceConfig, description: ViCareNumberEntityDescription, @@ -134,7 +126,6 @@ class ViCareNumber(ViCareEntity, NumberEntity): """Initialize the number.""" super().__init__(device_config, api, description.key) self.entity_description = description - self._attr_name = name @property def available(self) -> bool: diff --git a/homeassistant/components/vicare/sensor.py b/homeassistant/components/vicare/sensor.py index ae83459ddda..cc147f695c6 100644 --- a/homeassistant/components/vicare/sensor.py +++ b/homeassistant/components/vicare/sensor.py @@ -65,7 +65,7 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="outside_temperature", - name="Outside Temperature", + translation_key="outside_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getOutsideTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -73,7 +73,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="return_temperature", - name="Return Temperature", + translation_key="return_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getReturnTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -81,7 +81,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="boiler_temperature", - name="Boiler Temperature", + translation_key="boiler_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getBoilerTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -89,7 +89,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="boiler_supply_temperature", - name="Boiler Supply Temperature", + translation_key="boiler_supply_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getBoilerCommonSupplyTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -97,7 +97,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="primary_circuit_supply_temperature", - name="Primary Circuit Supply Temperature", + translation_key="primary_circuit_supply_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getSupplyTemperaturePrimaryCircuit(), device_class=SensorDeviceClass.TEMPERATURE, @@ -105,7 +105,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="primary_circuit_return_temperature", - name="Primary Circuit Return Temperature", + translation_key="primary_circuit_return_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getReturnTemperaturePrimaryCircuit(), device_class=SensorDeviceClass.TEMPERATURE, @@ -113,7 +113,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="secondary_circuit_supply_temperature", - name="Secondary Circuit Supply Temperature", + translation_key="secondary_circuit_supply_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getSupplyTemperatureSecondaryCircuit(), device_class=SensorDeviceClass.TEMPERATURE, @@ -121,7 +121,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="secondary_circuit_return_temperature", - name="Secondary Circuit Return Temperature", + translation_key="secondary_circuit_return_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getReturnTemperatureSecondaryCircuit(), device_class=SensorDeviceClass.TEMPERATURE, @@ -129,7 +129,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="hotwater_out_temperature", - name="Hot Water Out Temperature", + translation_key="hotwater_out_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getDomesticHotWaterOutletTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -137,7 +137,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="hotwater_max_temperature", - name="Hot Water Max Temperature", + translation_key="hotwater_max_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getDomesticHotWaterMaxTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -145,7 +145,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="hotwater_min_temperature", - name="Hot Water Min Temperature", + translation_key="hotwater_min_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getDomesticHotWaterMinTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -153,63 +153,63 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="hotwater_gas_consumption_today", - name="Hot water gas consumption today", + translation_key="hotwater_gas_consumption_today", value_getter=lambda api: api.getGasConsumptionDomesticHotWaterToday(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( 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(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( 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(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( 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(), unit_getter=lambda api: api.getGasConsumptionDomesticHotWaterUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( key="gas_consumption_heating_today", - name="Heating gas consumption today", + translation_key="gas_consumption_heating_today", value_getter=lambda api: api.getGasConsumptionHeatingToday(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( 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(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( 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(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( 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(), unit_getter=lambda api: api.getGasConsumptionHeatingUnit(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentDay(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), @@ -217,7 +217,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentMonth(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), @@ -225,7 +225,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionHeatingCurrentYear(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), @@ -233,7 +233,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionHeatingLastSevenDays(), unit_getter=lambda api: api.getGasSummaryConsumptionHeatingUnit(), @@ -241,7 +241,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentDay(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), @@ -249,7 +249,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentMonth(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), @@ -257,7 +257,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterCurrentYear(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), @@ -265,7 +265,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterLastSevenDays(), unit_getter=lambda api: api.getGasSummaryConsumptionDomesticHotWaterUnit(), @@ -273,7 +273,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentDay(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), @@ -281,7 +281,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentMonth(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), @@ -289,7 +289,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentYear(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), @@ -297,7 +297,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionHeatingLastSevenDays(), unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(), @@ -305,7 +305,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentDay(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), @@ -313,7 +313,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentMonth(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), @@ -321,7 +321,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentYear(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), @@ -329,7 +329,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterLastSevenDays(), unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(), @@ -337,7 +337,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power_production_current", - name="Power production current", + translation_key="power_production_current", native_unit_of_measurement=UnitOfPower.WATT, value_getter=lambda api: api.getPowerProductionCurrent(), device_class=SensorDeviceClass.POWER, @@ -345,7 +345,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power_production_today", - name="Energy production today", + translation_key="power_production_today", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerProductionToday(), device_class=SensorDeviceClass.ENERGY, @@ -353,7 +353,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power_production_this_week", - name="Energy production this week", + translation_key="power_production_this_week", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerProductionThisWeek(), device_class=SensorDeviceClass.ENERGY, @@ -361,7 +361,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power_production_this_month", - name="Energy production this month", + translation_key="power_production_this_month", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerProductionThisMonth(), device_class=SensorDeviceClass.ENERGY, @@ -369,7 +369,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power_production_this_year", - name="Energy production this year", + translation_key="power_production_this_year", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerProductionThisYear(), device_class=SensorDeviceClass.ENERGY, @@ -377,7 +377,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="solar storage temperature", - name="Solar Storage Temperature", + translation_key="solar_storage_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getSolarStorageTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -385,7 +385,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="collector temperature", - name="Solar Collector Temperature", + translation_key="collector_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getSolarCollectorTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -393,7 +393,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="solar power production today", - name="Solar energy production today", + translation_key="solar_power_production_today", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getSolarPowerProductionToday(), unit_getter=lambda api: api.getSolarPowerProductionUnit(), @@ -402,7 +402,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getSolarPowerProductionThisWeek(), unit_getter=lambda api: api.getSolarPowerProductionUnit(), @@ -411,7 +411,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getSolarPowerProductionThisMonth(), unit_getter=lambda api: api.getSolarPowerProductionUnit(), @@ -420,7 +420,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( 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, value_getter=lambda api: api.getSolarPowerProductionThisYear(), unit_getter=lambda api: api.getSolarPowerProductionUnit(), @@ -429,7 +429,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power consumption today", - name="Energy consumption today", + translation_key="power_consumption_today", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerConsumptionToday(), unit_getter=lambda api: api.getPowerConsumptionUnit(), @@ -438,7 +438,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power consumption this week", - name="Power consumption this week", + translation_key="power_consumption_this_week", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerConsumptionThisWeek(), unit_getter=lambda api: api.getPowerConsumptionUnit(), @@ -447,7 +447,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power consumption this month", - name="Energy consumption this month", + translation_key="power consumption this month", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerConsumptionThisMonth(), unit_getter=lambda api: api.getPowerConsumptionUnit(), @@ -456,7 +456,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="power consumption this year", - name="Energy consumption this year", + translation_key="power_consumption_this_year", native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, value_getter=lambda api: api.getPowerConsumptionThisYear(), unit_getter=lambda api: api.getPowerConsumptionUnit(), @@ -465,7 +465,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="buffer top temperature", - name="Buffer top temperature", + translation_key="buffer_top_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getBufferTopTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -473,7 +473,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="buffer main temperature", - name="Buffer main temperature", + translation_key="buffer_main_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getBufferMainTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -481,7 +481,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="volumetric_flow", - name="Volumetric flow", + translation_key="volumetric_flow", icon="mdi:gauge", native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR, value_getter=lambda api: api.getVolumetricFlowReturn() / 1000, @@ -493,7 +493,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="supply_temperature", - name="Supply Temperature", + translation_key="supply_temperature", native_unit_of_measurement=UnitOfTemperature.CELSIUS, value_getter=lambda api: api.getSupplyTemperature(), device_class=SensorDeviceClass.TEMPERATURE, @@ -504,14 +504,14 @@ CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="burner_starts", - name="Burner Starts", + translation_key="burner_starts", icon="mdi:counter", value_getter=lambda api: api.getStarts(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( key="burner_hours", - name="Burner Hours", + translation_key="burner_hours", icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHours(), @@ -519,7 +519,7 @@ BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="burner_modulation", - name="Burner Modulation", + translation_key="burner_modulation", icon="mdi:percent", native_unit_of_measurement=PERCENTAGE, value_getter=lambda api: api.getModulation(), @@ -530,14 +530,14 @@ BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="compressor_starts", - name="Compressor Starts", + translation_key="compressor_starts", icon="mdi:counter", value_getter=lambda api: api.getStarts(), state_class=SensorStateClass.TOTAL_INCREASING, ), ViCareSensorEntityDescription( key="compressor_hours", - name="Compressor Hours", + translation_key="compressor_hours", icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHours(), @@ -545,7 +545,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="compressor_hours_loadclass1", - name="Compressor Hours Load Class 1", + translation_key="compressor_hours_loadclass1", icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass1(), @@ -553,7 +553,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="compressor_hours_loadclass2", - name="Compressor Hours Load Class 2", + translation_key="compressor_hours_loadclass2", icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass2(), @@ -561,7 +561,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="compressor_hours_loadclass3", - name="Compressor Hours Load Class 3", + translation_key="compressor_hours_loadclass3", icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass3(), @@ -569,7 +569,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="compressor_hours_loadclass4", - name="Compressor Hours Load Class 4", + translation_key="compressor_hours_loadclass4", icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass4(), @@ -577,7 +577,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="compressor_hours_loadclass5", - name="Compressor Hours Load Class 5", + translation_key="compressor_hours_loadclass5", icon="mdi:counter", native_unit_of_measurement=UnitOfTime.HOURS, value_getter=lambda api: api.getHoursLoadClass5(), @@ -585,7 +585,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ), ViCareSensorEntityDescription( key="compressor_phase", - name="Compressor Phase", + translation_key="compressor_phase", icon="mdi:information", value_getter=lambda api: api.getPhase(), entity_category=EntityCategory.DIAGNOSTIC, @@ -594,16 +594,13 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( def _build_entity( - name: str, vicare_api, device_config: PyViCareDeviceConfig, entity_description: ViCareSensorEntityDescription, ): """Create a ViCare sensor entity.""" - _LOGGER.debug("Found device %s", name) - if is_supported(name, entity_description, vicare_api): + if is_supported(entity_description.key, entity_description, vicare_api): return ViCareSensor( - name, vicare_api, device_config, entity_description, @@ -621,12 +618,8 @@ async def _entities_from_descriptions( """Create entities from descriptions and list of burners/circuits.""" for description in sensor_descriptions: for current in iterables: - suffix = "" - if len(iterables) > 1: - suffix = f" {current.id}" entity = await hass.async_add_executor_job( _build_entity, - f"{description.name}{suffix}", current, hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], description, @@ -647,7 +640,6 @@ async def async_setup_entry( for description in GLOBAL_SENSORS: entity = await hass.async_add_executor_job( _build_entity, - description.name, api, hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], description, @@ -685,12 +677,14 @@ class ViCareSensor(ViCareEntity, SensorEntity): entity_description: ViCareSensorEntityDescription def __init__( - self, name, api, device_config, description: ViCareSensorEntityDescription + self, + api, + device_config: PyViCareDeviceConfig, + description: ViCareSensorEntityDescription, ) -> None: """Initialize the sensor.""" super().__init__(device_config, api, description.key) self.entity_description = description - self._attr_name = name @property def available(self) -> bool: diff --git a/homeassistant/components/vicare/strings.json b/homeassistant/components/vicare/strings.json index 2dc1eecd1e4..f3a51bde9e4 100644 --- a/homeassistant/components/vicare/strings.json +++ b/homeassistant/components/vicare/strings.json @@ -28,6 +28,266 @@ "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": { "set_vicare_mode": { "name": "Set ViCare mode", diff --git a/homeassistant/components/vicare/water_heater.py b/homeassistant/components/vicare/water_heater.py index 0e927a24650..570474f4186 100644 --- a/homeassistant/components/vicare/water_heater.py +++ b/homeassistant/components/vicare/water_heater.py @@ -3,6 +3,9 @@ from contextlib import suppress import logging 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 ( PyViCareInvalidDataError, PyViCareNotSupportedFeatureError, @@ -71,18 +74,15 @@ async def async_setup_entry( """Set up the ViCare climate platform.""" entities = [] 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) for circuit in circuits: - suffix = "" - if len(circuits) > 1: - suffix = f" {circuit.id}" - entity = ViCareWater( - f"Water{suffix}", api, circuit, - hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG], + device_config, + "water", ) entities.append(entity) @@ -99,13 +99,19 @@ class ViCareWater(ViCareEntity, WaterHeaterEntity): _attr_max_temp = VICARE_TEMP_WATER_MAX _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.""" super().__init__(device_config, api, circuit.id) - self._attr_name = name self._circuit = circuit self._attributes: dict[str, Any] = {} self._current_mode = None + self._attr_translation_key = translation_key def update(self) -> None: """Let HA know there has been an update from the ViCare API."""