Add entity translations to pvoutput (#96029)

This commit is contained in:
Joost Lekkerkerker 2023-07-07 18:58:55 +02:00 committed by GitHub
parent ac19de9857
commit daa9162ca7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 7 deletions

View File

@ -45,7 +45,7 @@ class PVOutputSensorEntityDescription(
SENSORS: tuple[PVOutputSensorEntityDescription, ...] = ( SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
PVOutputSensorEntityDescription( PVOutputSensorEntityDescription(
key="energy_consumption", key="energy_consumption",
name="Energy consumed", translation_key="energy_consumption",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
device_class=SensorDeviceClass.ENERGY, device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
@ -53,7 +53,7 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
), ),
PVOutputSensorEntityDescription( PVOutputSensorEntityDescription(
key="energy_generation", key="energy_generation",
name="Energy generated", translation_key="energy_generation",
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
device_class=SensorDeviceClass.ENERGY, device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
@ -61,7 +61,7 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
), ),
PVOutputSensorEntityDescription( PVOutputSensorEntityDescription(
key="normalized_output", key="normalized_output",
name="Efficiency", translation_key="efficiency",
native_unit_of_measurement=( native_unit_of_measurement=(
f"{UnitOfEnergy.KILO_WATT_HOUR}/{UnitOfPower.KILO_WATT}" f"{UnitOfEnergy.KILO_WATT_HOUR}/{UnitOfPower.KILO_WATT}"
), ),
@ -70,7 +70,7 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
), ),
PVOutputSensorEntityDescription( PVOutputSensorEntityDescription(
key="power_consumption", key="power_consumption",
name="Power consumed", translation_key="power_consumption",
native_unit_of_measurement=UnitOfPower.WATT, native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
@ -78,7 +78,7 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
), ),
PVOutputSensorEntityDescription( PVOutputSensorEntityDescription(
key="power_generation", key="power_generation",
name="Power generated", translation_key="power_generation",
native_unit_of_measurement=UnitOfPower.WATT, native_unit_of_measurement=UnitOfPower.WATT,
device_class=SensorDeviceClass.POWER, device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
@ -86,7 +86,6 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
), ),
PVOutputSensorEntityDescription( PVOutputSensorEntityDescription(
key="temperature", key="temperature",
name="Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS, native_unit_of_measurement=UnitOfTemperature.CELSIUS,
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
@ -94,7 +93,6 @@ SENSORS: tuple[PVOutputSensorEntityDescription, ...] = (
), ),
PVOutputSensorEntityDescription( PVOutputSensorEntityDescription(
key="voltage", key="voltage",
name="Voltage",
native_unit_of_measurement=UnitOfElectricPotential.VOLT, native_unit_of_measurement=UnitOfElectricPotential.VOLT,
device_class=SensorDeviceClass.VOLTAGE, device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,

View File

@ -23,5 +23,24 @@
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]", "already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]" "reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
} }
},
"entity": {
"sensor": {
"energy_consumption": {
"name": "Energy consumed"
},
"energy_generation": {
"name": "Energy generated"
},
"efficiency": {
"name": "Efficiency"
},
"power_consumption": {
"name": "Power consumed"
},
"power_generation": {
"name": "Power generated"
}
}
} }
} }