Use shorthand attributes in SRP Energy (#99881)

pull/99011/head^2
Joost Lekkerkerker 2023-09-08 01:20:22 +02:00 committed by GitHub
parent 92628ea068
commit 432894a401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 6 deletions

View File

@ -40,12 +40,7 @@ class SrpEntity(CoordinatorEntity[SRPEnergyDataUpdateCoordinator], SensorEntity)
"""Initialize the SrpEntity class."""
super().__init__(coordinator)
self._attr_unique_id = f"{config_entry.entry_id}_total_usage"
self._name = SENSOR_NAME
@property
def name(self) -> str:
"""Return the name of the sensor."""
return f"{DEFAULT_NAME} {self._name}"
self._attr_name = f"{DEFAULT_NAME} {SENSOR_NAME}"
@property
def native_value(self) -> float: