Use shorthand attribute for EAFM (#95233)

This commit is contained in:
Joost Lekkerkerker 2023-06-26 18:25:39 +02:00 committed by GitHub
parent 9e3706e3b9
commit a64940cf42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,6 +100,7 @@ class Measurement(CoordinatorEntity, SensorEntity):
"""Initialise the gauge with a data instance and station.""" """Initialise the gauge with a data instance and station."""
super().__init__(coordinator) super().__init__(coordinator)
self.key = key self.key = key
self._attr_unique_id = key
@property @property
def station_name(self): def station_name(self):
@ -126,11 +127,6 @@ class Measurement(CoordinatorEntity, SensorEntity):
"""Return the name of the gauge.""" """Return the name of the gauge."""
return f"{self.station_name} {self.parameter_name} {self.qualifier}" return f"{self.station_name} {self.parameter_name} {self.qualifier}"
@property
def unique_id(self):
"""Return the unique id of the gauge."""
return self.key
@property @property
def device_info(self): def device_info(self):
"""Return the device info.""" """Return the device info."""