<commit_before>"""Constants for the Awair component."""
from __future__ import annotations

from dataclasses import dataclass
from datetime import timedelta
import logging

from python_awair.air_data import AirData
from python_awair.devices import AwairDevice

from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
from homeassistant.const import (
    CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
    CONCENTRATION_PARTS_PER_BILLION,
    CONCENTRATION_PARTS_PER_MILLION,
    LIGHT_LUX,
    PERCENTAGE,
    SOUND_PRESSURE_WEIGHTED_DBA,
    TEMP_CELSIUS,
)

API_CO2 = "carbon_dioxide"
API_DUST = "dust"
API_HUMID = "humidity"
API_LUX = "illuminance"
API_PM10 = "particulate_matter_10"
API_PM25 = "particulate_matter_2_5"
API_SCORE = "score"
API_SPL_A = "sound_pressure_level"
API_TEMP = "temperature"
API_TIMEOUT = 20
API_VOC = "volatile_organic_compounds"

ATTRIBUTION = "Awair air quality sensor"

DOMAIN = "awair"

DUST_ALIASES = [API_PM25, API_PM10]

LOGGER = logging.getLogger(__package__)

UPDATE_INTERVAL = timedelta(minutes=5)


@dataclass
class AwairRequiredKeysMixin:
    """Mixinf for required keys."""

    unique_id_tag: str


@dataclass
class AwairSensorEntityDescription(SensorEntityDescription, AwairRequiredKeysMixin):
    """Describes Awair sensor entity."""


SENSOR_TYPE_SCORE = AwairSensorEntityDescription(
    key=API_SCORE,
    icon="mdi:blur",
    native_unit_of_measurement=PERCENTAGE,
    name="Awair score",
    unique_id_tag="score",  # matches legacy format
)

SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
    AwairSensorEntityDescription(
        key=API_HUMID,
        device_class=SensorDeviceClass.HUMIDITY,
        native_unit_of_measurement=PERCENTAGE,
        name="Humidity",
        unique_id_tag="HUMID",  # matches legacy format
    ),
    AwairSensorEntityDescription(<commit_msg>spelling: components/awair (#64230)<commit_after>"""Constants for the Awair component."""
from __future__ import annotations

from dataclasses import dataclass
from datetime import timedelta
import logging

from python_awair.air_data import AirData
from python_awair.devices import AwairDevice

from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
from homeassistant.const import (
    CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
    CONCENTRATION_PARTS_PER_BILLION,
    CONCENTRATION_PARTS_PER_MILLION,
    LIGHT_LUX,
    PERCENTAGE,
    SOUND_PRESSURE_WEIGHTED_DBA,
    TEMP_CELSIUS,
)

API_CO2 = "carbon_dioxide"
API_DUST = "dust"
API_HUMID = "humidity"
API_LUX = "illuminance"
API_PM10 = "particulate_matter_10"
API_PM25 = "particulate_matter_2_5"
API_SCORE = "score"
API_SPL_A = "sound_pressure_level"
API_TEMP = "temperature"
API_TIMEOUT = 20
API_VOC = "volatile_organic_compounds"

ATTRIBUTION = "Awair air quality sensor"

DOMAIN = "awair"

DUST_ALIASES = [API_PM25, API_PM10]

LOGGER = logging.getLogger(__package__)

UPDATE_INTERVAL = timedelta(minutes=5)


@dataclass
class AwairRequiredKeysMixin:
    """Mixin for required keys."""

    unique_id_tag: str


@dataclass
class AwairSensorEntityDescription(SensorEntityDescription, AwairRequiredKeysMixin):
    """Describes Awair sensor entity."""


SENSOR_TYPE_SCORE = AwairSensorEntityDescription(
    key=API_SCORE,
    icon="mdi:blur",
    native_unit_of_measurement=PERCENTAGE,
    name="Awair score",
    unique_id_tag="score",  # matches legacy format
)

SENSOR_TYPES: tuple[AwairSensorEntityDescription, ...] = (
    AwairSensorEntityDescription(
        key=API_HUMID,
        device_class=SensorDeviceClass.HUMIDITY,
        native_unit_of_measurement=PERCENTAGE,
        name="Humidity",
        unique_id_tag="HUMID",  # matches legacy format
    ),
    AwairSensorEntityDescription(
{'fraction_non_alphanumeric': 0.07917888563049853, 'fraction_numerical': 0.009864036256998134, 'mean_word_length': 5.491349480968858, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6801284', 'n_tokens_mistral': 1365, 'n_tokens_neox': 1316, 'n_words': 237}