Skip to content

Commit

Permalink
Finish Efergy entity translations (#107152)
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek authored Jan 5, 2024
1 parent c805ea7 commit 6033a7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions homeassistant/components/efergy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}"
)
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/components/efergy/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
},
"cost_year": {
"name": "Yearly energy cost"
},
"power_usage": {
"name": "Power usage {sid}"
}
}
}
Expand Down

0 comments on commit 6033a7c

Please sign in to comment.