diff --git a/homeassistant/components/openuv/sensor.py b/homeassistant/components/openuv/sensor.py index 0660ca740ac..467ef0dfe3a 100644 --- a/homeassistant/components/openuv/sensor.py +++ b/homeassistant/components/openuv/sensor.py @@ -2,12 +2,13 @@ from __future__ import annotations from homeassistant.components.sensor import ( - STATE_CLASS_MEASUREMENT, + SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.config_entries import ConfigEntry -from homeassistant.const import DEVICE_CLASS_OZONE, TIME_MINUTES, UV_INDEX +from homeassistant.const import TIME_MINUTES, UV_INDEX from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.util.dt import as_local, parse_datetime @@ -49,16 +50,16 @@ SENSOR_DESCRIPTIONS = ( SensorEntityDescription( key=TYPE_CURRENT_OZONE_LEVEL, name="Current Ozone Level", - device_class=DEVICE_CLASS_OZONE, + device_class=SensorDeviceClass.OZONE, native_unit_of_measurement="du", - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_CURRENT_UV_INDEX, name="Current UV Index", icon="mdi:weather-sunny", native_unit_of_measurement=UV_INDEX, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_CURRENT_UV_LEVEL, @@ -70,49 +71,49 @@ SENSOR_DESCRIPTIONS = ( name="Max UV Index", icon="mdi:weather-sunny", native_unit_of_measurement=UV_INDEX, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_1, name="Skin Type 1 Safe Exposure Time", icon="mdi:timer-outline", native_unit_of_measurement=TIME_MINUTES, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_2, name="Skin Type 2 Safe Exposure Time", icon="mdi:timer-outline", native_unit_of_measurement=TIME_MINUTES, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_3, name="Skin Type 3 Safe Exposure Time", icon="mdi:timer-outline", native_unit_of_measurement=TIME_MINUTES, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_4, name="Skin Type 4 Safe Exposure Time", icon="mdi:timer-outline", native_unit_of_measurement=TIME_MINUTES, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_5, name="Skin Type 5 Safe Exposure Time", icon="mdi:timer-outline", native_unit_of_measurement=TIME_MINUTES, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key=TYPE_SAFE_EXPOSURE_TIME_6, name="Skin Type 6 Safe Exposure Time", icon="mdi:timer-outline", native_unit_of_measurement=TIME_MINUTES, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, ), )