mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +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_device_class = device_class
|
||||||
self._attr_icon = icon
|
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._attr_unit_of_measurement = unit
|
||||||
self._kind = kind
|
self._kind = kind
|
||||||
self._name = name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_info(self):
|
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
|
@callback
|
||||||
def update_from_latest_data(self):
|
def update_from_latest_data(self):
|
||||||
"""Update the entity from the latest data."""
|
"""Update the entity from the latest data."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user