diff --git a/homeassistant/components/miflora/sensor.py b/homeassistant/components/miflora/sensor.py index 1b13b4d0537..aed52014228 100644 --- a/homeassistant/components/miflora/sensor.py +++ b/homeassistant/components/miflora/sensor.py @@ -12,9 +12,10 @@ import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, - STATE_CLASS_MEASUREMENT, + SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.const import ( CONDUCTIVITY, @@ -23,9 +24,6 @@ from homeassistant.const import ( CONF_MONITORED_CONDITIONS, CONF_NAME, CONF_SCAN_INTERVAL, - DEVICE_CLASS_BATTERY, - DEVICE_CLASS_ILLUMINANCE, - DEVICE_CLASS_TEMPERATURE, EVENT_HOMEASSISTANT_START, LIGHT_LUX, PERCENTAGE, @@ -63,13 +61,13 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( key="temperature", name="Temperature", native_unit_of_measurement=TEMP_CELSIUS, - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, ), SensorEntityDescription( key="light", name="Light intensity", native_unit_of_measurement=LIGHT_LUX, - device_class=DEVICE_CLASS_ILLUMINANCE, + device_class=SensorDeviceClass.ILLUMINANCE, ), SensorEntityDescription( key="moisture", @@ -87,7 +85,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( key="battery", name="Battery", native_unit_of_measurement=PERCENTAGE, - device_class=DEVICE_CLASS_BATTERY, + device_class=SensorDeviceClass.BATTERY, ), ) @@ -148,7 +146,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= class MiFloraSensor(SensorEntity): """Implementing the MiFlora sensor.""" - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_state_class = SensorStateClass.MEASUREMENT def __init__( self,