From 7fef87691af5c4231bc37e5d935a7d9ac7fdd8a8 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Wed, 21 Jul 2021 08:07:26 -0400 Subject: [PATCH] Use entity class attributes for airvisual (#52503) * Use entity class attributes for airvisual * fix * rework * tweaks * finish * remove overriden available attribute * rework --- homeassistant/components/airvisual/sensor.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/airvisual/sensor.py b/homeassistant/components/airvisual/sensor.py index 796607f8215..d4b988a0ddc 100644 --- a/homeassistant/components/airvisual/sensor.py +++ b/homeassistant/components/airvisual/sensor.py @@ -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."""