mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add unique ID to PVOutput entities (#62890)
This commit is contained in:
parent
1af3177466
commit
cee0440ab6
@ -115,6 +115,7 @@ async def async_setup_entry(
|
|||||||
PVOutputSensorEntity(
|
PVOutputSensorEntity(
|
||||||
coordinator=coordinator,
|
coordinator=coordinator,
|
||||||
description=description,
|
description=description,
|
||||||
|
system_id=entry.data[CONF_SYSTEM_ID],
|
||||||
)
|
)
|
||||||
for description in SENSORS
|
for description in SENSORS
|
||||||
)
|
)
|
||||||
@ -131,10 +132,12 @@ class PVOutputSensorEntity(CoordinatorEntity, SensorEntity):
|
|||||||
*,
|
*,
|
||||||
coordinator: DataUpdateCoordinator,
|
coordinator: DataUpdateCoordinator,
|
||||||
description: PVOutputSensorEntityDescription,
|
description: PVOutputSensorEntityDescription,
|
||||||
|
system_id: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize a PVOutput sensor."""
|
"""Initialize a PVOutput sensor."""
|
||||||
super().__init__(coordinator=coordinator)
|
super().__init__(coordinator=coordinator)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
|
self._attr_unique_id = f"{system_id}_{description.key}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> int | float | None:
|
def native_value(self) -> int | float | None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user