Add entity translations to Vallox (#96495)

pull/96872/head
Joost Lekkerkerker 2023-07-18 21:07:45 +02:00 committed by GitHub
parent c94c7fae1b
commit e29598ecaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 84 additions and 25 deletions

View File

@ -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)

View File

@ -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",
),

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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",

View File

@ -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",
),