diff --git a/homeassistant/components/sht31/sensor.py b/homeassistant/components/sht31/sensor.py index 2d7c81072f6..ff8c5251ca7 100644 --- a/homeassistant/components/sht31/sensor.py +++ b/homeassistant/components/sht31/sensor.py @@ -12,14 +12,13 @@ import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, + SensorDeviceClass, SensorEntity, SensorEntityDescription, ) from homeassistant.const import ( CONF_MONITORED_CONDITIONS, CONF_NAME, - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_TEMPERATURE, PERCENTAGE, TEMP_CELSIUS, ) @@ -50,14 +49,14 @@ SENSOR_TYPES = ( SHT31SensorEntityDescription( key="temperature", name="Temperature", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=TEMP_CELSIUS, value_fn=lambda sensor: sensor.temperature, ), SHT31SensorEntityDescription( key="humidity", name="Humidity", - device_class=DEVICE_CLASS_HUMIDITY, + device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, value_fn=lambda sensor: ( round(val) # pylint: disable=undefined-variable