mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use enums in waqi (#61998)
This commit is contained in:
parent
7764772202
commit
9d66dd35cc
@ -7,13 +7,16 @@ import aiohttp
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from waqiasync import WaqiClient
|
from waqiasync import WaqiClient
|
||||||
|
|
||||||
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity
|
from homeassistant.components.sensor import (
|
||||||
|
SensorDeviceClass,
|
||||||
|
SensorEntity,
|
||||||
|
SensorStateClass,
|
||||||
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
ATTR_TEMPERATURE,
|
ATTR_TEMPERATURE,
|
||||||
ATTR_TIME,
|
ATTR_TIME,
|
||||||
CONF_TOKEN,
|
CONF_TOKEN,
|
||||||
DEVICE_CLASS_AQI,
|
|
||||||
)
|
)
|
||||||
from homeassistant.exceptions import PlatformNotReady
|
from homeassistant.exceptions import PlatformNotReady
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
@ -102,8 +105,8 @@ class WaqiSensor(SensorEntity):
|
|||||||
|
|
||||||
_attr_icon = ATTR_ICON
|
_attr_icon = ATTR_ICON
|
||||||
_attr_native_unit_of_measurement = ATTR_UNIT
|
_attr_native_unit_of_measurement = ATTR_UNIT
|
||||||
_attr_device_class = DEVICE_CLASS_AQI
|
_attr_device_class = SensorDeviceClass.AQI
|
||||||
_attr_state_class = STATE_CLASS_MEASUREMENT
|
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||||
|
|
||||||
def __init__(self, client, station):
|
def __init__(self, client, station):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user