diff --git a/homeassistant/components/somfy/cover.py b/homeassistant/components/somfy/cover.py index 8ed06b3bcd7..ac89f9b609e 100644 --- a/homeassistant/components/somfy/cover.py +++ b/homeassistant/components/somfy/cover.py @@ -6,8 +6,6 @@ from pymfy.api.devices.category import Category from homeassistant.components.cover import ( ATTR_POSITION, ATTR_TILT_POSITION, - DEVICE_CLASS_BLIND, - DEVICE_CLASS_SHUTTER, SUPPORT_CLOSE, SUPPORT_CLOSE_TILT, SUPPORT_OPEN, @@ -16,6 +14,7 @@ from homeassistant.components.cover import ( SUPPORT_SET_TILT_POSITION, SUPPORT_STOP, SUPPORT_STOP_TILT, + CoverDeviceClass, CoverEntity, ) from homeassistant.const import CONF_OPTIMISTIC, STATE_CLOSED, STATE_OPEN @@ -123,9 +122,9 @@ class SomfyCover(SomfyEntity, RestoreEntity, CoverEntity): def device_class(self): """Return the device class.""" if self.categories & BLIND_DEVICE_CATEGORIES: - return DEVICE_CLASS_BLIND + return CoverDeviceClass.BLIND if self.categories & SHUTTER_DEVICE_CATEGORIES: - return DEVICE_CLASS_SHUTTER + return CoverDeviceClass.SHUTTER return None @property diff --git a/homeassistant/components/somfy/sensor.py b/homeassistant/components/somfy/sensor.py index 9a0602cb592..c39565e6e3b 100644 --- a/homeassistant/components/somfy/sensor.py +++ b/homeassistant/components/somfy/sensor.py @@ -3,8 +3,8 @@ from pymfy.api.devices.category import Category from pymfy.api.devices.thermostat import Thermostat -from homeassistant.components.sensor import SensorEntity -from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE +from homeassistant.components.sensor import SensorDeviceClass, SensorEntity +from homeassistant.const import PERCENTAGE from .const import COORDINATOR, DOMAIN from .entity import SomfyEntity @@ -29,7 +29,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class SomfyThermostatBatterySensor(SomfyEntity, SensorEntity): """Representation of a Somfy thermostat battery.""" - _attr_device_class = DEVICE_CLASS_BATTERY + _attr_device_class = SensorDeviceClass.BATTERY _attr_native_unit_of_measurement = PERCENTAGE def __init__(self, coordinator, device_id):