2021-06-09 11:22:37 +00:00
|
|
|
"""Constants for the Ambee integration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from datetime import timedelta
|
|
|
|
import logging
|
2021-06-10 12:18:09 +00:00
|
|
|
from typing import Final
|
2021-06-09 11:22:37 +00:00
|
|
|
|
2021-07-26 20:00:43 +00:00
|
|
|
from homeassistant.components.sensor import (
|
2021-12-08 20:13:59 +00:00
|
|
|
SensorDeviceClass,
|
2021-07-26 20:00:43 +00:00
|
|
|
SensorEntityDescription,
|
2021-12-08 20:13:59 +00:00
|
|
|
SensorStateClass,
|
2021-07-26 20:00:43 +00:00
|
|
|
)
|
2021-06-09 11:22:37 +00:00
|
|
|
from homeassistant.const import (
|
|
|
|
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
|
|
|
CONCENTRATION_PARTS_PER_BILLION,
|
2021-06-10 12:18:09 +00:00
|
|
|
CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-06-09 11:22:37 +00:00
|
|
|
CONCENTRATION_PARTS_PER_MILLION,
|
|
|
|
)
|
|
|
|
|
|
|
|
DOMAIN: Final = "ambee"
|
|
|
|
LOGGER = logging.getLogger(__package__)
|
2021-06-10 13:08:35 +00:00
|
|
|
SCAN_INTERVAL = timedelta(hours=1)
|
2021-06-09 11:22:37 +00:00
|
|
|
|
2021-06-10 12:18:09 +00:00
|
|
|
DEVICE_CLASS_AMBEE_RISK: Final = "ambee__risk"
|
|
|
|
|
|
|
|
SERVICE_AIR_QUALITY: Final = "air_quality"
|
|
|
|
SERVICE_POLLEN: Final = "pollen"
|
|
|
|
|
|
|
|
SERVICES: dict[str, str] = {
|
2022-07-11 07:51:01 +00:00
|
|
|
SERVICE_AIR_QUALITY: "Air quality",
|
2021-06-10 12:18:09 +00:00
|
|
|
SERVICE_POLLEN: "Pollen",
|
|
|
|
}
|
|
|
|
|
2021-07-26 20:00:43 +00:00
|
|
|
SENSORS: dict[str, list[SensorEntityDescription]] = {
|
|
|
|
SERVICE_AIR_QUALITY: [
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="particulate_matter_2_5",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Particulate matter < 2.5 μm",
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="particulate_matter_10",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Particulate matter < 10 μm",
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="sulphur_dioxide",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Sulphur dioxide (SO2)",
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="nitrogen_dioxide",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Nitrogen dioxide (NO2)",
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="ozone",
|
|
|
|
name="Ozone",
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION,
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="carbon_monoxide",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Carbon monoxide (CO)",
|
2021-12-08 20:13:59 +00:00
|
|
|
device_class=SensorDeviceClass.CO,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="air_quality_index",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Air quality index (AQI)",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
SERVICE_POLLEN: [
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="grass",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Grass",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:grass",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="weed",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Weed",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:sprout",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="grass_risk",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Grass risk",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:grass",
|
|
|
|
device_class=DEVICE_CLASS_AMBEE_RISK,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_risk",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Tree risk",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
|
|
|
device_class=DEVICE_CLASS_AMBEE_RISK,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="weed_risk",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Weed risk",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:sprout",
|
|
|
|
device_class=DEVICE_CLASS_AMBEE_RISK,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="grass_poaceae",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Poaceae grass",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:grass",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_alder",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Alder tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_birch",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Birch tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_cypress",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Cypress tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_elm",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Elm tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_hazel",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Hazel tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_oak",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Oak tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_pine",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Pine tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_plane",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Plane tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="tree_poplar",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Poplar tree",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:tree",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="weed_chenopod",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Chenopod weed",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:sprout",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="weed_mugwort",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Mugwort weed",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:sprout",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="weed_nettle",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Nettle weed",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:sprout",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
SensorEntityDescription(
|
|
|
|
key="weed_ragweed",
|
2022-07-11 07:51:01 +00:00
|
|
|
name="Ragweed weed",
|
2021-07-26 20:00:43 +00:00
|
|
|
icon="mdi:sprout",
|
2021-12-08 20:13:59 +00:00
|
|
|
state_class=SensorStateClass.MEASUREMENT,
|
2021-08-11 08:45:05 +00:00
|
|
|
native_unit_of_measurement=CONCENTRATION_PARTS_PER_CUBIC_METER,
|
2021-07-26 20:00:43 +00:00
|
|
|
entity_registry_enabled_default=False,
|
|
|
|
),
|
|
|
|
],
|
2021-06-09 11:22:37 +00:00
|
|
|
}
|