Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate EAFM to has entity name #98121

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions homeassistant/components/eafm/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class Measurement(CoordinatorEntity, SensorEntity):
"from the real-time data API"
)
_attr_state_class = SensorStateClass.MEASUREMENT
_attr_has_entity_name = True
_attr_name = None

def __init__(self, coordinator, key):
"""Initialise the gauge with a data instance and station."""
Expand Down Expand Up @@ -122,11 +124,6 @@ def parameter_name(self):
"""Return the parameter name for the station."""
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
def device_info(self):
"""Return the device info."""
Expand All @@ -135,7 +132,7 @@ def device_info(self):
identifiers={(DOMAIN, "measure-id", self.station_id)},
manufacturer="https://environment.data.gov.uk/",
model=self.parameter_name,
name=self.name,
name=f"{self.station_name} {self.parameter_name} {self.qualifier}",
)

@property
Expand Down