diff --git a/homeassistant/components/efergy/sensor.py b/homeassistant/components/efergy/sensor.py index 809f1c531da798..dd8752dde7f70e 100644 --- a/homeassistant/components/efergy/sensor.py +++ b/homeassistant/components/efergy/sensor.py @@ -96,7 +96,7 @@ ), SensorEntityDescription( key=CONF_CURRENT_VALUES, - name="Power Usage", + translation_key="power_usage", device_class=SensorDeviceClass.POWER, native_unit_of_measurement=UnitOfPower.WATT, state_class=SensorStateClass.MEASUREMENT, @@ -156,7 +156,8 @@ def __init__( super().__init__(api, server_unique_id) self.entity_description = description 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 = ( f"{server_unique_id}/{description.key}_{'' if sid is None else sid}" ) diff --git a/homeassistant/components/efergy/strings.json b/homeassistant/components/efergy/strings.json index 3b17bf07f1ae4d..612c964487b8de 100644 --- a/homeassistant/components/efergy/strings.json +++ b/homeassistant/components/efergy/strings.json @@ -48,6 +48,9 @@ }, "cost_year": { "name": "Yearly energy cost" + }, + "power_usage": { + "name": "Power usage {sid}" } } }