From e29598ecaa581e789987d855781fd9f6daef2baf Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 18 Jul 2023 21:07:45 +0200 Subject: [PATCH] Add entity translations to Vallox (#96495) --- homeassistant/components/vallox/__init__.py | 2 + .../components/vallox/binary_sensor.py | 3 +- homeassistant/components/vallox/fan.py | 1 - homeassistant/components/vallox/number.py | 7 +- homeassistant/components/vallox/sensor.py | 29 ++++----- homeassistant/components/vallox/strings.json | 64 +++++++++++++++++++ homeassistant/components/vallox/switch.py | 3 +- 7 files changed, 84 insertions(+), 25 deletions(-) diff --git a/homeassistant/components/vallox/__init__.py b/homeassistant/components/vallox/__init__.py index 6f8d00eb48c..473b9fa07d1 100644 --- a/homeassistant/components/vallox/__init__.py +++ b/homeassistant/components/vallox/__init__.py @@ -304,6 +304,8 @@ class ValloxServiceHandler: class ValloxEntity(CoordinatorEntity[ValloxDataUpdateCoordinator]): """Representation of a Vallox entity.""" + _attr_has_entity_name = True + def __init__(self, name: str, coordinator: ValloxDataUpdateCoordinator) -> None: """Initialize a Vallox entity.""" super().__init__(coordinator) diff --git a/homeassistant/components/vallox/binary_sensor.py b/homeassistant/components/vallox/binary_sensor.py index 2d40c43836d..05085c24424 100644 --- a/homeassistant/components/vallox/binary_sensor.py +++ b/homeassistant/components/vallox/binary_sensor.py @@ -21,7 +21,6 @@ class ValloxBinarySensorEntity(ValloxEntity, BinarySensorEntity): entity_description: ValloxBinarySensorEntityDescription _attr_entity_category = EntityCategory.DIAGNOSTIC - _attr_has_entity_name = True def __init__( self, @@ -59,7 +58,7 @@ class ValloxBinarySensorEntityDescription( BINARY_SENSOR_ENTITIES: tuple[ValloxBinarySensorEntityDescription, ...] = ( ValloxBinarySensorEntityDescription( key="post_heater", - name="Post heater", + translation_key="post_heater", icon="mdi:radiator", metric_key="A_CYC_IO_HEATER", ), diff --git a/homeassistant/components/vallox/fan.py b/homeassistant/components/vallox/fan.py index b43dabbba80..2f420096c74 100644 --- a/homeassistant/components/vallox/fan.py +++ b/homeassistant/components/vallox/fan.py @@ -83,7 +83,6 @@ async def async_setup_entry( class ValloxFanEntity(ValloxEntity, FanEntity): """Representation of the fan.""" - _attr_has_entity_name = True _attr_name = None _attr_supported_features = FanEntityFeature.PRESET_MODE | FanEntityFeature.SET_SPEED diff --git a/homeassistant/components/vallox/number.py b/homeassistant/components/vallox/number.py index 36145f85bc7..ce43ca9c3fb 100644 --- a/homeassistant/components/vallox/number.py +++ b/homeassistant/components/vallox/number.py @@ -23,7 +23,6 @@ class ValloxNumberEntity(ValloxEntity, NumberEntity): """Representation of a Vallox number entity.""" entity_description: ValloxNumberEntityDescription - _attr_has_entity_name = True _attr_entity_category = EntityCategory.CONFIG def __init__( @@ -76,7 +75,7 @@ class ValloxNumberEntityDescription(NumberEntityDescription, ValloxMetricMixin): NUMBER_ENTITIES: tuple[ValloxNumberEntityDescription, ...] = ( ValloxNumberEntityDescription( key="supply_air_target_home", - name="Supply air temperature (Home)", + translation_key="supply_air_target_home", metric_key="A_CYC_HOME_AIR_TEMP_TARGET", device_class=NumberDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -87,7 +86,7 @@ NUMBER_ENTITIES: tuple[ValloxNumberEntityDescription, ...] = ( ), ValloxNumberEntityDescription( key="supply_air_target_away", - name="Supply air temperature (Away)", + translation_key="supply_air_target_away", metric_key="A_CYC_AWAY_AIR_TEMP_TARGET", device_class=NumberDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -98,7 +97,7 @@ NUMBER_ENTITIES: tuple[ValloxNumberEntityDescription, ...] = ( ), ValloxNumberEntityDescription( key="supply_air_target_boost", - name="Supply air temperature (Boost)", + translation_key="supply_air_target_boost", metric_key="A_CYC_BOOST_AIR_TEMP_TARGET", device_class=NumberDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, diff --git a/homeassistant/components/vallox/sensor.py b/homeassistant/components/vallox/sensor.py index a4f6563798d..ee0e1e43204 100644 --- a/homeassistant/components/vallox/sensor.py +++ b/homeassistant/components/vallox/sensor.py @@ -38,7 +38,6 @@ class ValloxSensorEntity(ValloxEntity, SensorEntity): entity_description: ValloxSensorEntityDescription _attr_entity_category = EntityCategory.DIAGNOSTIC - _attr_has_entity_name = True def __init__( self, @@ -138,13 +137,13 @@ class ValloxSensorEntityDescription(SensorEntityDescription): SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ValloxSensorEntityDescription( key="current_profile", - name="Current profile", + translation_key="current_profile", icon="mdi:gauge", entity_type=ValloxProfileSensor, ), ValloxSensorEntityDescription( key="fan_speed", - name="Fan speed", + translation_key="fan_speed", metric_key="A_CYC_FAN_SPEED", icon="mdi:fan", state_class=SensorStateClass.MEASUREMENT, @@ -153,7 +152,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="extract_fan_speed", - name="Extract fan speed", + translation_key="extract_fan_speed", metric_key="A_CYC_EXTR_FAN_SPEED", icon="mdi:fan", state_class=SensorStateClass.MEASUREMENT, @@ -163,7 +162,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="supply_fan_speed", - name="Supply fan speed", + translation_key="supply_fan_speed", metric_key="A_CYC_SUPP_FAN_SPEED", icon="mdi:fan", state_class=SensorStateClass.MEASUREMENT, @@ -173,20 +172,20 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="remaining_time_for_filter", - name="Remaining time for filter", + translation_key="remaining_time_for_filter", device_class=SensorDeviceClass.TIMESTAMP, entity_type=ValloxFilterRemainingSensor, ), ValloxSensorEntityDescription( key="cell_state", - name="Cell state", + translation_key="cell_state", icon="mdi:swap-horizontal-bold", metric_key="A_CYC_CELL_STATE", entity_type=ValloxCellStateSensor, ), ValloxSensorEntityDescription( key="extract_air", - name="Extract air", + translation_key="extract_air", metric_key="A_CYC_TEMP_EXTRACT_AIR", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -194,7 +193,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="exhaust_air", - name="Exhaust air", + translation_key="exhaust_air", metric_key="A_CYC_TEMP_EXHAUST_AIR", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -202,7 +201,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="outdoor_air", - name="Outdoor air", + translation_key="outdoor_air", metric_key="A_CYC_TEMP_OUTDOOR_AIR", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -210,7 +209,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="supply_air", - name="Supply air", + translation_key="supply_air", metric_key="A_CYC_TEMP_SUPPLY_AIR", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -218,7 +217,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="supply_cell_air", - name="Supply cell air", + translation_key="supply_cell_air", metric_key="A_CYC_TEMP_SUPPLY_CELL_AIR", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -226,7 +225,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="optional_air", - name="Optional air", + translation_key="optional_air", metric_key="A_CYC_TEMP_OPTIONAL", device_class=SensorDeviceClass.TEMPERATURE, state_class=SensorStateClass.MEASUREMENT, @@ -235,7 +234,6 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="humidity", - name="Humidity", metric_key="A_CYC_RH_VALUE", device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, @@ -243,7 +241,7 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="efficiency", - name="Efficiency", + translation_key="efficiency", metric_key="A_CYC_EXTRACT_EFFICIENCY", icon="mdi:gauge", state_class=SensorStateClass.MEASUREMENT, @@ -253,7 +251,6 @@ SENSOR_ENTITIES: tuple[ValloxSensorEntityDescription, ...] = ( ), ValloxSensorEntityDescription( key="co2", - name="CO2", metric_key="A_CYC_CO2_VALUE", device_class=SensorDeviceClass.CO2, state_class=SensorStateClass.MEASUREMENT, diff --git a/homeassistant/components/vallox/strings.json b/homeassistant/components/vallox/strings.json index 42efaeb0538..acc6a31f158 100644 --- a/homeassistant/components/vallox/strings.json +++ b/homeassistant/components/vallox/strings.json @@ -19,6 +19,70 @@ "unknown": "[%key:common::config_flow::error::unknown%]" } }, + "entity": { + "binary_sensor": { + "post_heater": { + "name": "Post heater" + } + }, + "number": { + "supply_air_target_home": { + "name": "Supply air temperature (Home)" + }, + "supply_air_target_away": { + "name": "Supply air temperature (Away)" + }, + "supply_air_target_boost": { + "name": "Supply air temperature (Boost)" + } + }, + "sensor": { + "current_profile": { + "name": "Current profile" + }, + "fan_speed": { + "name": "Fan speed" + }, + "extract_fan_speed": { + "name": "Extract fan speed" + }, + "supply_fan_speed": { + "name": "Supply fan speed" + }, + "remaining_time_for_filter": { + "name": "Remaining time for filter" + }, + "cell_state": { + "name": "Cell state" + }, + "extract_air": { + "name": "Extract air" + }, + "exhaust_air": { + "name": "Exhaust air" + }, + "outdoor_air": { + "name": "Outdoor air" + }, + "supply_air": { + "name": "Supply air" + }, + "supply_cell_air": { + "name": "Supply cell air" + }, + "optional_air": { + "name": "Optional air" + }, + "efficiency": { + "name": "Efficiency" + } + }, + "switch": { + "bypass_locked": { + "name": "Bypass locked" + } + } + }, "services": { "set_profile_fan_speed_home": { "name": "Set profile fan speed home", diff --git a/homeassistant/components/vallox/switch.py b/homeassistant/components/vallox/switch.py index 7e8cb4e39c5..194659d40cd 100644 --- a/homeassistant/components/vallox/switch.py +++ b/homeassistant/components/vallox/switch.py @@ -21,7 +21,6 @@ class ValloxSwitchEntity(ValloxEntity, SwitchEntity): entity_description: ValloxSwitchEntityDescription _attr_entity_category = EntityCategory.CONFIG - _attr_has_entity_name = True def __init__( self, @@ -79,7 +78,7 @@ class ValloxSwitchEntityDescription(SwitchEntityDescription, ValloxMetricKeyMixi SWITCH_ENTITIES: tuple[ValloxSwitchEntityDescription, ...] = ( ValloxSwitchEntityDescription( key="bypass_locked", - name="Bypass locked", + translation_key="bypass_locked", icon="mdi:arrow-horizontal-lock", metric_key="A_CYC_BYPASS_LOCKED", ),