diff --git a/homeassistant/components/plaato/binary_sensor.py b/homeassistant/components/plaato/binary_sensor.py index 52213d46791..14f2d2a069d 100644 --- a/homeassistant/components/plaato/binary_sensor.py +++ b/homeassistant/components/plaato/binary_sensor.py @@ -1,10 +1,10 @@ """Support for Plaato Airlock sensors.""" +from __future__ import annotations from pyplaato.plaato import PlaatoKeg from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_OPENING, - DEVICE_CLASS_PROBLEM, + BinarySensorDeviceClass, BinarySensorEntity, ) @@ -40,11 +40,11 @@ class PlaatoBinarySensor(PlaatoEntity, BinarySensorEntity): return False @property - def device_class(self): - """Return the class of this device, from component DEVICE_CLASSES.""" + def device_class(self) -> BinarySensorDeviceClass | None: + """Return the class of this device, from BinarySensorDeviceClass.""" if self._coordinator is None: return None if self._sensor_type is PlaatoKeg.Pins.LEAK_DETECTION: - return DEVICE_CLASS_PROBLEM + return BinarySensorDeviceClass.PROBLEM if self._sensor_type is PlaatoKeg.Pins.POURING: - return DEVICE_CLASS_OPENING + return BinarySensorDeviceClass.OPENING diff --git a/homeassistant/components/plaato/sensor.py b/homeassistant/components/plaato/sensor.py index e3e37d4291e..398f44b72ff 100644 --- a/homeassistant/components/plaato/sensor.py +++ b/homeassistant/components/plaato/sensor.py @@ -4,7 +4,7 @@ from __future__ import annotations from pyplaato.models.device import PlaatoDevice from pyplaato.plaato import PlaatoKeg -from homeassistant.components.sensor import DEVICE_CLASS_TEMPERATURE, SensorEntity +from homeassistant.components.sensor import SensorDeviceClass, SensorEntity from homeassistant.helpers.dispatcher import ( async_dispatcher_connect, async_dispatcher_send, @@ -63,15 +63,15 @@ class PlaatoSensor(PlaatoEntity, SensorEntity): """Representation of a Plaato Sensor.""" @property - def device_class(self) -> str | None: - """Return the class of this device, from component DEVICE_CLASSES.""" + def device_class(self) -> SensorDeviceClass | None: + """Return the class of this device, from SensorDeviceClass.""" if ( self._coordinator is not None and self._sensor_type == PlaatoKeg.Pins.TEMPERATURE ): - return DEVICE_CLASS_TEMPERATURE + return SensorDeviceClass.TEMPERATURE if self._sensor_type == ATTR_TEMP: - return DEVICE_CLASS_TEMPERATURE + return SensorDeviceClass.TEMPERATURE return None @property