Use enum sensor device class in AirVisual (#83316)
This commit is contained in:
parent
b97f95efc4
commit
150e49f4c2
4 changed files with 61 additions and 25 deletions
|
@ -43,9 +43,6 @@ ATTR_POLLUTANT_SYMBOL = "pollutant_symbol"
|
|||
ATTR_POLLUTANT_UNIT = "pollutant_unit"
|
||||
ATTR_REGION = "region"
|
||||
|
||||
DEVICE_CLASS_POLLUTANT_LABEL = "airvisual__pollutant_label"
|
||||
DEVICE_CLASS_POLLUTANT_LEVEL = "airvisual__pollutant_level"
|
||||
|
||||
SENSOR_KIND_AQI = "air_quality_index"
|
||||
SENSOR_KIND_BATTERY_LEVEL = "battery_level"
|
||||
SENSOR_KIND_CO2 = "carbon_dioxide"
|
||||
|
@ -63,8 +60,17 @@ GEOGRAPHY_SENSOR_DESCRIPTIONS = (
|
|||
SensorEntityDescription(
|
||||
key=SENSOR_KIND_LEVEL,
|
||||
name="Air pollution level",
|
||||
device_class=DEVICE_CLASS_POLLUTANT_LEVEL,
|
||||
icon="mdi:gauge",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=[
|
||||
"good",
|
||||
"moderate",
|
||||
"unhealthy",
|
||||
"unhealthy_sensitive",
|
||||
"very_unhealthy",
|
||||
"hazardous",
|
||||
],
|
||||
translation_key="pollutant_level",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=SENSOR_KIND_AQI,
|
||||
|
@ -76,8 +82,10 @@ GEOGRAPHY_SENSOR_DESCRIPTIONS = (
|
|||
SensorEntityDescription(
|
||||
key=SENSOR_KIND_POLLUTANT,
|
||||
name="Main pollutant",
|
||||
device_class=DEVICE_CLASS_POLLUTANT_LABEL,
|
||||
icon="mdi:chemical-weapon",
|
||||
device_class=SensorDeviceClass.ENUM,
|
||||
options=["co", "n2", "o3", "p1", "p2", "s2"],
|
||||
translation_key="pollutant_label",
|
||||
),
|
||||
)
|
||||
GEOGRAPHY_SENSOR_LOCALES = {"cn": "Chinese", "us": "U.S."}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue