Use enums in sht31 (#62036)
This commit is contained in:
parent
b6ed3e87e0
commit
9ddf2035d0
1 changed files with 3 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue