Use shorthand attribute in Bloomsky (#100203)

This commit is contained in:
Joost Lekkerkerker 2023-09-12 16:37:35 +02:00 committed by GitHub
parent d495208995
commit 4e17901fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,6 +100,7 @@ class BloomSkySensor(SensorEntity):
self._sensor_name = sensor_name
self._attr_name = f"{device['DeviceName']} {sensor_name}"
self._attr_unique_id = f"{self._device_id}-{sensor_name}"
self._attr_device_class = SENSOR_DEVICE_CLASS.get(sensor_name)
self._attr_native_unit_of_measurement = SENSOR_UNITS_IMPERIAL.get(
sensor_name, None
)
@ -108,11 +109,6 @@ class BloomSkySensor(SensorEntity):
sensor_name, None
)
@property
def device_class(self) -> SensorDeviceClass | None:
"""Return the class of this device, from component DEVICE_CLASSES."""
return SENSOR_DEVICE_CLASS.get(self._sensor_name)
def update(self) -> None:
"""Request an update from the BloomSky API."""
self._bloomsky.refresh_devices()