Skip to content

Commit 6a54edc

Browse files
Gives a friendly name to emoncms entities if unit is not specified (#133358)
1 parent 34ab3e0 commit 6a54edc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

homeassistant/components/emoncms/sensor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ async def async_setup_entry(
317317
EmonCmsSensor(
318318
coordinator,
319319
unique_id,
320-
elem["unit"],
320+
elem.get("unit"),
321321
name,
322322
idx,
323323
)
@@ -353,6 +353,7 @@ def __init__(
353353
self.entity_description = description
354354
else:
355355
self._attr_native_unit_of_measurement = unit_of_measurement
356+
self._attr_name = f"{name} {elem[FEED_NAME]}"
356357
self._update_attributes(elem)
357358

358359
def _update_attributes(self, elem: dict[str, Any]) -> None:

0 commit comments

Comments
 (0)