mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Migrate EAFM to has entity name (#98121)
This commit is contained in:
parent
4c03077dfe
commit
138854a9cc
@ -95,6 +95,8 @@ class Measurement(CoordinatorEntity, SensorEntity):
|
|||||||
"from the real-time data API"
|
"from the real-time data API"
|
||||||
)
|
)
|
||||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
_attr_name = None
|
||||||
|
|
||||||
def __init__(self, coordinator, key):
|
def __init__(self, coordinator, key):
|
||||||
"""Initialise the gauge with a data instance and station."""
|
"""Initialise the gauge with a data instance and station."""
|
||||||
@ -122,11 +124,6 @@ class Measurement(CoordinatorEntity, SensorEntity):
|
|||||||
"""Return the parameter name for the station."""
|
"""Return the parameter name for the station."""
|
||||||
return self.coordinator.data["measures"][self.key]["parameterName"]
|
return self.coordinator.data["measures"][self.key]["parameterName"]
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return the name of the gauge."""
|
|
||||||
return f"{self.station_name} {self.parameter_name} {self.qualifier}"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
def device_info(self):
|
||||||
"""Return the device info."""
|
"""Return the device info."""
|
||||||
@ -135,7 +132,7 @@ class Measurement(CoordinatorEntity, SensorEntity):
|
|||||||
identifiers={(DOMAIN, "measure-id", self.station_id)},
|
identifiers={(DOMAIN, "measure-id", self.station_id)},
|
||||||
manufacturer="https://environment.data.gov.uk/",
|
manufacturer="https://environment.data.gov.uk/",
|
||||||
model=self.parameter_name,
|
model=self.parameter_name,
|
||||||
name=self.name,
|
name=f"{self.station_name} {self.parameter_name} {self.qualifier}",
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user