diff --git a/homeassistant/components/tado/binary_sensor.py b/homeassistant/components/tado/binary_sensor.py index 9f68aa8a4e7..4d61ebe4651 100644 --- a/homeassistant/components/tado/binary_sensor.py +++ b/homeassistant/components/tado/binary_sensor.py @@ -2,10 +2,7 @@ import logging from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_BATTERY, - DEVICE_CLASS_CONNECTIVITY, - DEVICE_CLASS_POWER, - DEVICE_CLASS_WINDOW, + BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.config_entries import ConfigEntry @@ -143,9 +140,9 @@ class TadoDeviceBinarySensor(TadoDeviceEntity, BinarySensorEntity): def device_class(self): """Return the class of this sensor.""" if self.device_variable == "battery state": - return DEVICE_CLASS_BATTERY + return BinarySensorDeviceClass.BATTERY if self.device_variable == "connection state": - return DEVICE_CLASS_CONNECTIVITY + return BinarySensorDeviceClass.CONNECTIVITY return None @callback @@ -219,15 +216,15 @@ class TadoZoneBinarySensor(TadoZoneEntity, BinarySensorEntity): def device_class(self): """Return the class of this sensor.""" if self.zone_variable == "early start": - return DEVICE_CLASS_POWER + return BinarySensorDeviceClass.POWER if self.zone_variable == "link": - return DEVICE_CLASS_CONNECTIVITY + return BinarySensorDeviceClass.CONNECTIVITY if self.zone_variable == "open window": - return DEVICE_CLASS_WINDOW + return BinarySensorDeviceClass.WINDOW if self.zone_variable == "overlay": - return DEVICE_CLASS_POWER + return BinarySensorDeviceClass.POWER if self.zone_variable == "power": - return DEVICE_CLASS_POWER + return BinarySensorDeviceClass.POWER return None @property diff --git a/homeassistant/components/tado/sensor.py b/homeassistant/components/tado/sensor.py index 872e2cbb42e..5a124dff3b8 100644 --- a/homeassistant/components/tado/sensor.py +++ b/homeassistant/components/tado/sensor.py @@ -1,14 +1,13 @@ """Support for Tado sensors for each zone.""" import logging -from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity -from homeassistant.config_entries import ConfigEntry -from homeassistant.const import ( - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_TEMPERATURE, - PERCENTAGE, - TEMP_CELSIUS, +from homeassistant.components.sensor import ( + SensorDeviceClass, + SensorEntity, + SensorStateClass, ) +from homeassistant.config_entries import ConfigEntry +from homeassistant.const import PERCENTAGE, TEMP_CELSIUS from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher import async_dispatcher_connect @@ -150,14 +149,14 @@ class TadoHomeSensor(TadoHomeEntity, SensorEntity): def device_class(self): """Return the device class.""" if self.home_variable == "outdoor temperature": - return DEVICE_CLASS_TEMPERATURE + return SensorDeviceClass.TEMPERATURE return None @property def state_class(self): """Return the state class.""" if self.home_variable in ["outdoor temperature", "solar percentage"]: - return STATE_CLASS_MEASUREMENT + return SensorStateClass.MEASUREMENT return None @callback @@ -261,16 +260,16 @@ class TadoZoneSensor(TadoZoneEntity, SensorEntity): def device_class(self): """Return the device class.""" if self.zone_variable == "humidity": - return DEVICE_CLASS_HUMIDITY + return SensorDeviceClass.HUMIDITY if self.zone_variable == "temperature": - return DEVICE_CLASS_TEMPERATURE + return SensorDeviceClass.TEMPERATURE return None @property def state_class(self): """Return the state class.""" if self.zone_variable in ["ac", "heating", "humidity", "temperature"]: - return STATE_CLASS_MEASUREMENT + return SensorStateClass.MEASUREMENT return None @callback