mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Use new SensorDeviceClass enum in bme280 (#61319)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
0c96b27ab2
commit
c7eae8b0bc
@ -3,14 +3,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntityDescription
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
|
||||||
from homeassistant.const import (
|
from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_PRESSURE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
PERCENTAGE,
|
|
||||||
TEMP_CELSIUS,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Common
|
# Common
|
||||||
DOMAIN = "bme280"
|
DOMAIN = "bme280"
|
||||||
@ -34,19 +28,19 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
key=SENSOR_TEMP,
|
key=SENSOR_TEMP,
|
||||||
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_HUMID,
|
key=SENSOR_HUMID,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=SENSOR_PRESS,
|
key=SENSOR_PRESS,
|
||||||
name="Pressure",
|
name="Pressure",
|
||||||
native_unit_of_measurement="mb",
|
native_unit_of_measurement="mb",
|
||||||
device_class=DEVICE_CLASS_PRESSURE,
|
device_class=SensorDeviceClass.PRESSURE,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
SENSOR_KEYS: list[str] = [desc.key for desc in SENSOR_TYPES]
|
SENSOR_KEYS: list[str] = [desc.key for desc in SENSOR_TYPES]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user