Use SensorDeviceClass in mhz19 (#61923)

This commit is contained in:
epenet 2021-12-15 20:11:06 +01:00 committed by GitHub
parent b42e2e6ef0
commit 2da2de2ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,6 +9,7 @@ import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
@ -17,8 +18,6 @@ from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
CONF_MONITORED_CONDITIONS,
CONF_NAME,
DEVICE_CLASS_CO2,
DEVICE_CLASS_TEMPERATURE,
TEMP_CELSIUS,
)
import homeassistant.helpers.config_validation as cv
@ -40,13 +39,13 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key=SENSOR_TEMPERATURE,
name="Temperature",
native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key=SENSOR_CO2,
name="CO2",
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
device_class=DEVICE_CLASS_CO2,
device_class=SensorDeviceClass.CO2,
),
)
SENSOR_KEYS: list[str] = [desc.key for desc in SENSOR_TYPES]