mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use new enums in miflora (#61922)
This commit is contained in:
parent
66b8f87e43
commit
67061aeb7d
@ -12,9 +12,10 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
PLATFORM_SCHEMA,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONDUCTIVITY,
|
||||
@ -23,9 +24,6 @@ from homeassistant.const import (
|
||||
CONF_MONITORED_CONDITIONS,
|
||||
CONF_NAME,
|
||||
CONF_SCAN_INTERVAL,
|
||||
DEVICE_CLASS_BATTERY,
|
||||
DEVICE_CLASS_ILLUMINANCE,
|
||||
DEVICE_CLASS_TEMPERATURE,
|
||||
EVENT_HOMEASSISTANT_START,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
@ -63,13 +61,13 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
key="temperature",
|
||||
name="Temperature",
|
||||
native_unit_of_measurement=TEMP_CELSIUS,
|
||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="light",
|
||||
name="Light intensity",
|
||||
native_unit_of_measurement=LIGHT_LUX,
|
||||
device_class=DEVICE_CLASS_ILLUMINANCE,
|
||||
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="moisture",
|
||||
@ -87,7 +85,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
key="battery",
|
||||
name="Battery",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
device_class=DEVICE_CLASS_BATTERY,
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
),
|
||||
)
|
||||
|
||||
@ -148,7 +146,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
||||
class MiFloraSensor(SensorEntity):
|
||||
"""Implementing the MiFlora sensor."""
|
||||
|
||||
_attr_state_class = STATE_CLASS_MEASUREMENT
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
Loading…
x
Reference in New Issue
Block a user