Use SensorDeviceClass enum in Luftdaten (#61746)

pull/61748/head
Franck Nijhof 2021-12-14 05:39:19 +01:00 committed by GitHub
parent 1ed6abe23d
commit 4a1f49852a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -7,7 +7,7 @@ from luftdaten import Luftdaten
from luftdaten.exceptions import LuftdatenError from luftdaten.exceptions import LuftdatenError
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import SensorEntityDescription from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import ( from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
@ -15,9 +15,6 @@ from homeassistant.const import (
CONF_SCAN_INTERVAL, CONF_SCAN_INTERVAL,
CONF_SENSORS, CONF_SENSORS,
CONF_SHOW_ON_MAP, CONF_SHOW_ON_MAP,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
PERCENTAGE, PERCENTAGE,
PRESSURE_PA, PRESSURE_PA,
TEMP_CELSIUS, TEMP_CELSIUS,
@ -55,28 +52,28 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key=SENSOR_TEMPERATURE, key=SENSOR_TEMPERATURE,
name="Temperature", name="Temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_HUMIDITY, key=SENSOR_HUMIDITY,
name="Humidity", name="Humidity",
icon="mdi:water-percent", icon="mdi:water-percent",
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
device_class=DEVICE_CLASS_HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_PRESSURE, key=SENSOR_PRESSURE,
name="Pressure", name="Pressure",
icon="mdi:arrow-down-bold", icon="mdi:arrow-down-bold",
native_unit_of_measurement=PRESSURE_PA, native_unit_of_measurement=PRESSURE_PA,
device_class=DEVICE_CLASS_PRESSURE, device_class=SensorDeviceClass.PRESSURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_PRESSURE_AT_SEALEVEL, key=SENSOR_PRESSURE_AT_SEALEVEL,
name="Pressure at sealevel", name="Pressure at sealevel",
icon="mdi:download", icon="mdi:download",
native_unit_of_measurement=PRESSURE_PA, native_unit_of_measurement=PRESSURE_PA,
device_class=DEVICE_CLASS_PRESSURE, device_class=SensorDeviceClass.PRESSURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key=SENSOR_PM10, key=SENSOR_PM10,