mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Finish Efergy entity translations (#107152)
This commit is contained in:
parent
c805ea7b4f
commit
6033a7c3d4
@ -96,7 +96,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CONF_CURRENT_VALUES,
|
key=CONF_CURRENT_VALUES,
|
||||||
name="Power Usage",
|
translation_key="power_usage",
|
||||||
device_class=SensorDeviceClass.POWER,
|
device_class=SensorDeviceClass.POWER,
|
||||||
native_unit_of_measurement=UnitOfPower.WATT,
|
native_unit_of_measurement=UnitOfPower.WATT,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
@ -156,7 +156,8 @@ class EfergySensor(EfergyEntity, SensorEntity):
|
|||||||
super().__init__(api, server_unique_id)
|
super().__init__(api, server_unique_id)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
if description.key == CONF_CURRENT_VALUES:
|
if description.key == CONF_CURRENT_VALUES:
|
||||||
self._attr_name = f"{description.name}_{'' if sid is None else sid}"
|
assert sid is not None
|
||||||
|
self._attr_translation_placeholders = {"sid": str(sid)}
|
||||||
self._attr_unique_id = (
|
self._attr_unique_id = (
|
||||||
f"{server_unique_id}/{description.key}_{'' if sid is None else sid}"
|
f"{server_unique_id}/{description.key}_{'' if sid is None else sid}"
|
||||||
)
|
)
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
},
|
},
|
||||||
"cost_year": {
|
"cost_year": {
|
||||||
"name": "Yearly energy cost"
|
"name": "Yearly energy cost"
|
||||||
|
},
|
||||||
|
"power_usage": {
|
||||||
|
"name": "Power usage {sid}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user