mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use entity class attributes for airvisual (#52503)
* Use entity class attributes for airvisual * fix * rework * tweaks * finish * remove overriden available attribute * rework
This commit is contained in:
parent
462db1b4b2
commit
7fef87691a
@ -266,9 +266,12 @@ class AirVisualNodeProSensor(AirVisualEntity, SensorEntity):
|
||||
|
||||
self._attr_device_class = device_class
|
||||
self._attr_icon = icon
|
||||
self._attr_name = (
|
||||
f"{coordinator.data['settings']['node_name']} Node/Pro: {name}"
|
||||
)
|
||||
self._attr_unique_id = f"{coordinator.data['serial_number']}_{kind}"
|
||||
self._attr_unit_of_measurement = unit
|
||||
self._kind = kind
|
||||
self._name = name
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
@ -284,17 +287,6 @@ class AirVisualNodeProSensor(AirVisualEntity, SensorEntity):
|
||||
),
|
||||
}
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return the name."""
|
||||
node_name = self.coordinator.data["settings"]["node_name"]
|
||||
return f"{node_name} Node/Pro: {self._name}"
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique, Home Assistant friendly identifier for this entity."""
|
||||
return f"{self.coordinator.data['serial_number']}_{self._kind}"
|
||||
|
||||
@callback
|
||||
def update_from_latest_data(self):
|
||||
"""Update the entity from the latest data."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user