mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Gives a friendly name to emoncms entities if unit is not specified (#133358)
This commit is contained in:
parent
34ab3e033f
commit
6a54edce19
@ -317,7 +317,7 @@ async def async_setup_entry(
|
||||
EmonCmsSensor(
|
||||
coordinator,
|
||||
unique_id,
|
||||
elem["unit"],
|
||||
elem.get("unit"),
|
||||
name,
|
||||
idx,
|
||||
)
|
||||
@ -353,6 +353,7 @@ class EmonCmsSensor(CoordinatorEntity[EmoncmsCoordinator], SensorEntity):
|
||||
self.entity_description = description
|
||||
else:
|
||||
self._attr_native_unit_of_measurement = unit_of_measurement
|
||||
self._attr_name = f"{name} {elem[FEED_NAME]}"
|
||||
self._update_attributes(elem)
|
||||
|
||||
def _update_attributes(self, elem: dict[str, Any]) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user