"""Sensor entities for the SWS12500 integration for old endpoint.""" from __future__ import annotations from homeassistant.components.sensor import SensorDeviceClass, SensorStateClass from homeassistant.const import ( CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, CONCENTRATION_PARTS_PER_BILLION, CONCENTRATION_PARTS_PER_MILLION, DEGREE, PERCENTAGE, UV_INDEX, UnitOfIrradiance, UnitOfLength, UnitOfPrecipitationDepth, UnitOfPressure, UnitOfSpeed, UnitOfTemperature, UnitOfTime, UnitOfVolumetricFlux, ) from .battery_sensors_def import BATTERY_LEVEL_SENSORS from .const import ( ABS_PRESSURE, BARO_PRESSURE, CH2_BATTERY, CH2_HUMIDITY, CH2_TEMP, CH3_BATTERY, CH3_HUMIDITY, CH3_TEMP, CH4_BATTERY, CH4_HUMIDITY, CH4_TEMP, CH5_BATTERY, CH5_HUMIDITY, CH5_TEMP, CH6_BATTERY, CH6_HUMIDITY, CH6_TEMP, CH7_BATTERY, CH7_HUMIDITY, CH7_TEMP, CH8_BATTERY, CH8_HUMIDITY, CH8_TEMP, CHILL_INDEX, CO, CO2, DAILY_RAIN, DEW_POINT, FEELS_LIKE, HCHO, HEAT_INDEX, HOURLY_RAIN, INDOOR_BATTERY, INDOOR_HUMIDITY, INDOOR_TEMP, LIGHTNING_COUNT_1D, LIGHTNING_COUNT_1H, LIGHTNING_COUNT_5M, LIGHTNING_COUNT_30M, LIGHTNING_DISTANCE, LIGHTNING_LAST, LIGHTNING_STRIKES_1H, MONTHLY_RAIN, OUTSIDE_BATTERY, OUTSIDE_HUMIDITY, OUTSIDE_TEMP, PM10, PM10_AQI, PM25, PM25_AQI, RAIN, SOLAR_RADIATION, UV, VOC, WBGT_TEMP, WEEKLY_RAIN, WIND_AZIMUT, WIND_DIR, WIND_GUST, WIND_SPEED, WIND_SPEED_AVG10, YEARLY_RAIN, UnitOfBat, UnitOfDir, VOCLevel, ) from .sensors_common import WeatherSensorEntityDescription from .utils import ( battery_level, lightning_minutes, to_float, to_int, voc_level_to_text, wind_dir_to_text, wslink_chill_index, wslink_heat_index, ) SENSOR_TYPES_WSLINK: tuple[WeatherSensorEntityDescription, ...] = ( WeatherSensorEntityDescription( key=INDOOR_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, icon="mdi:thermometer", device_class=SensorDeviceClass.TEMPERATURE, translation_key=INDOOR_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=INDOOR_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, icon="mdi:thermometer", device_class=SensorDeviceClass.HUMIDITY, translation_key=INDOOR_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=OUTSIDE_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, icon="mdi:thermometer", device_class=SensorDeviceClass.TEMPERATURE, translation_key=OUTSIDE_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=OUTSIDE_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, icon="mdi:thermometer", device_class=SensorDeviceClass.HUMIDITY, translation_key=OUTSIDE_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=DEW_POINT, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, icon="mdi:thermometer-lines", device_class=SensorDeviceClass.TEMPERATURE, translation_key=DEW_POINT, value_fn=to_float, ), WeatherSensorEntityDescription( key=BARO_PRESSURE, native_unit_of_measurement=UnitOfPressure.HPA, state_class=SensorStateClass.MEASUREMENT, icon="mdi:thermometer-lines", device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE, suggested_unit_of_measurement=UnitOfPressure.HPA, translation_key=BARO_PRESSURE, value_fn=to_float, ), WeatherSensorEntityDescription( key=WIND_SPEED, native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.WIND_SPEED, suggested_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, icon="mdi:weather-windy", translation_key=WIND_SPEED, value_fn=to_float, ), WeatherSensorEntityDescription( key=WIND_GUST, native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.WIND_SPEED, suggested_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, icon="mdi:windsock", translation_key=WIND_GUST, value_fn=to_float, ), WeatherSensorEntityDescription( key=WIND_DIR, native_unit_of_measurement=DEGREE, state_class=SensorStateClass.MEASUREMENT_ANGLE, device_class=SensorDeviceClass.WIND_DIRECTION, suggested_display_precision=None, icon="mdi:sign-direction", translation_key=WIND_DIR, value_fn=to_int, ), WeatherSensorEntityDescription( key=WIND_AZIMUT, icon="mdi:sign-direction", value_from_data_fn=lambda dir: wind_dir_to_text(dir.get(WIND_DIR)), device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfDir], translation_key=WIND_AZIMUT, ), WeatherSensorEntityDescription( key=RAIN, native_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, state_class=SensorStateClass.MEASUREMENT, suggested_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=RAIN, value_fn=to_float, ), WeatherSensorEntityDescription( key=DAILY_RAIN, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, device_class=SensorDeviceClass.PRECIPITATION, state_class=SensorStateClass.MEASUREMENT, suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=DAILY_RAIN, value_fn=to_float, ), WeatherSensorEntityDescription( key=HOURLY_RAIN, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, device_class=SensorDeviceClass.PRECIPITATION, state_class=SensorStateClass.MEASUREMENT, suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=HOURLY_RAIN, value_fn=to_float, ), WeatherSensorEntityDescription( key=WEEKLY_RAIN, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, device_class=SensorDeviceClass.PRECIPITATION, state_class=SensorStateClass.MEASUREMENT, suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=WEEKLY_RAIN, value_fn=to_float, ), WeatherSensorEntityDescription( key=MONTHLY_RAIN, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, device_class=SensorDeviceClass.PRECIPITATION, state_class=SensorStateClass.MEASUREMENT, suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=MONTHLY_RAIN, value_fn=to_float, ), WeatherSensorEntityDescription( key=YEARLY_RAIN, native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, device_class=SensorDeviceClass.PRECIPITATION, state_class=SensorStateClass.MEASUREMENT, suggested_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS, suggested_display_precision=2, icon="mdi:weather-pouring", translation_key=YEARLY_RAIN, value_fn=to_float, ), WeatherSensorEntityDescription( key=SOLAR_RADIATION, native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.IRRADIANCE, icon="mdi:weather-sunny", translation_key=SOLAR_RADIATION, value_fn=to_float, ), WeatherSensorEntityDescription( key=UV, name=UV, state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UV_INDEX, icon="mdi:sunglasses", translation_key=UV, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH2_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, icon="mdi:weather-sunny", translation_key=CH2_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH2_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.HUMIDITY, icon="mdi:weather-sunny", translation_key=CH2_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=CH3_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, icon="mdi:weather-sunny", translation_key=CH3_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH3_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.HUMIDITY, icon="mdi:weather-sunny", translation_key=CH3_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=CH4_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, icon="mdi:weather-sunny", translation_key=CH4_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH4_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.HUMIDITY, icon="mdi:weather-sunny", translation_key=CH4_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=CH5_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, icon="mdi:weather-sunny", translation_key=CH5_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH5_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.HUMIDITY, icon="mdi:weather-sunny", translation_key=CH5_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=CH6_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, icon="mdi:weather-sunny", translation_key=CH6_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH6_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.HUMIDITY, icon="mdi:weather-sunny", translation_key=CH6_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=CH7_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, icon="mdi:weather-sunny", translation_key=CH7_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH7_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.HUMIDITY, icon="mdi:weather-sunny", translation_key=CH7_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=CH8_TEMP, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, icon="mdi:weather-sunny", translation_key=CH8_TEMP, value_fn=to_float, ), WeatherSensorEntityDescription( key=CH8_HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.HUMIDITY, icon="mdi:weather-sunny", translation_key=CH8_HUMIDITY, value_fn=to_int, ), WeatherSensorEntityDescription( key=CH3_BATTERY, translation_key=CH3_BATTERY, icon="mdi:battery-unknown", device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_fn=to_int, value_from_data_fn=lambda data: battery_level(data.get(CH3_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=CH3_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=CH4_BATTERY, translation_key=CH4_BATTERY, icon="mdi:battery-unknown", device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_fn=to_int, value_from_data_fn=lambda data: battery_level(data.get(CH4_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=CH4_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=CH5_BATTERY, translation_key=CH5_BATTERY, icon="mdi:battery-unknown", device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_fn=to_int, value_from_data_fn=lambda data: battery_level(data.get(CH5_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=CH5_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=CH6_BATTERY, translation_key=CH6_BATTERY, icon="mdi:battery-unknown", device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_from_data_fn=lambda data: battery_level(data.get(CH6_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=CH6_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=CH7_BATTERY, translation_key=CH7_BATTERY, icon="mdi:battery-unknown", device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_from_data_fn=lambda data: battery_level(data.get(CH7_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=CH7_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=CH8_BATTERY, translation_key=CH8_BATTERY, icon="mdi:battery-unknown", device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_from_data_fn=lambda data: battery_level(data.get(CH8_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=CH8_BATTERY, entity_registry_enabled_default=False, ), # `value_from_data_fn` takes precedence in `WeatherSensor.native_value`, so these # use the station's own t1heat/t1chill when present and compute them otherwise - # stations that do not report them used to leave both entities Unavailable forever. WeatherSensorEntityDescription( key=HEAT_INDEX, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, suggested_display_precision=2, icon="mdi:weather-sunny", translation_key=HEAT_INDEX, value_from_data_fn=wslink_heat_index, ), WeatherSensorEntityDescription( key=CHILL_INDEX, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_unit_of_measurement=UnitOfTemperature.CELSIUS, suggested_display_precision=2, icon="mdi:weather-sunny", translation_key=CHILL_INDEX, value_from_data_fn=wslink_chill_index, ), WeatherSensorEntityDescription( key=OUTSIDE_BATTERY, translation_key=OUTSIDE_BATTERY, device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_fn=None, value_from_data_fn=lambda data: battery_level(data.get(OUTSIDE_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=OUTSIDE_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=CH2_BATTERY, translation_key=CH2_BATTERY, device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_fn=None, value_from_data_fn=lambda data: battery_level(data.get(CH2_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=CH2_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=INDOOR_BATTERY, translation_key=INDOOR_BATTERY, device_class=SensorDeviceClass.ENUM, options=[e.value for e in UnitOfBat], value_fn=to_int, value_from_data_fn=lambda data: battery_level(data.get(INDOOR_BATTERY, None)).value, deprecated=True, replacement_entity_domain="binary_sensor", replacement_entity_key=INDOOR_BATTERY, entity_registry_enabled_default=False, ), WeatherSensorEntityDescription( key=WBGT_TEMP, translation_key=WBGT_TEMP, icon="mdi:thermometer", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, suggested_display_precision=2, value_fn=to_float, ), WeatherSensorEntityDescription( key=HCHO, translation_key=HCHO, device_class=SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS, native_unit_of_measurement=CONCENTRATION_PARTS_PER_BILLION, state_class=SensorStateClass.MEASUREMENT, icon="mdi:molecule", value_fn=to_int, ), WeatherSensorEntityDescription( key=VOC, translation_key=VOC, device_class=SensorDeviceClass.ENUM, options=list(VOCLevel), icon="mdi:air-filter", value_fn=voc_level_to_text, ), # --- Base console ------------------------------------------------------- WeatherSensorEntityDescription( key=ABS_PRESSURE, native_unit_of_measurement=UnitOfPressure.HPA, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.ATMOSPHERIC_PRESSURE, icon="mdi:gauge", translation_key=ABS_PRESSURE, value_fn=to_float, ), # --- Type1 outdoor ------------------------------------------------------ WeatherSensorEntityDescription( key=FEELS_LIKE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, suggested_display_precision=2, icon="mdi:thermometer", translation_key=FEELS_LIKE, value_fn=to_float, ), WeatherSensorEntityDescription( key=WIND_SPEED_AVG10, native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.WIND_SPEED, suggested_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR, icon="mdi:weather-windy", translation_key=WIND_SPEED_AVG10, value_fn=to_float, ), # --- Type5 lightning ---------------------------------------------------- WeatherSensorEntityDescription( key=LIGHTNING_LAST, native_unit_of_measurement=UnitOfTime.MINUTES, icon="mdi:flash-alert", translation_key=LIGHTNING_LAST, # No device class: the API does not define an epoch, so this cannot be a # TIMESTAMP (which HA requires to be a tz-aware datetime). value_fn=lightning_minutes, ), WeatherSensorEntityDescription( key=LIGHTNING_DISTANCE, native_unit_of_measurement=UnitOfLength.KILOMETERS, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.DISTANCE, icon="mdi:flash", translation_key=LIGHTNING_DISTANCE, value_fn=to_float, ), WeatherSensorEntityDescription( key=LIGHTNING_STRIKES_1H, # Rolling windows, not monotonic totals, so MEASUREMENT rather than # TOTAL_INCREASING - the latter would make long-term statistics meaningless. state_class=SensorStateClass.MEASUREMENT, icon="mdi:flash", translation_key=LIGHTNING_STRIKES_1H, value_fn=to_int, ), WeatherSensorEntityDescription( key=LIGHTNING_COUNT_5M, # Rolling windows, not monotonic totals, so MEASUREMENT rather than # TOTAL_INCREASING - the latter would make long-term statistics meaningless. state_class=SensorStateClass.MEASUREMENT, icon="mdi:flash", translation_key=LIGHTNING_COUNT_5M, value_fn=to_int, ), WeatherSensorEntityDescription( key=LIGHTNING_COUNT_30M, # Rolling windows, not monotonic totals, so MEASUREMENT rather than # TOTAL_INCREASING - the latter would make long-term statistics meaningless. state_class=SensorStateClass.MEASUREMENT, icon="mdi:flash", translation_key=LIGHTNING_COUNT_30M, value_fn=to_int, ), WeatherSensorEntityDescription( key=LIGHTNING_COUNT_1H, # Rolling windows, not monotonic totals, so MEASUREMENT rather than # TOTAL_INCREASING - the latter would make long-term statistics meaningless. state_class=SensorStateClass.MEASUREMENT, icon="mdi:flash", translation_key=LIGHTNING_COUNT_1H, value_fn=to_int, ), WeatherSensorEntityDescription( key=LIGHTNING_COUNT_1D, # Rolling windows, not monotonic totals, so MEASUREMENT rather than # TOTAL_INCREASING - the latter would make long-term statistics meaningless. state_class=SensorStateClass.MEASUREMENT, icon="mdi:flash", translation_key=LIGHTNING_COUNT_1D, value_fn=to_int, ), # --- Type8 particulate matter ------------------------------------------- WeatherSensorEntityDescription( key=PM25, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.PM25, translation_key=PM25, value_fn=to_int, ), WeatherSensorEntityDescription( key=PM10, native_unit_of_measurement=CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.PM10, translation_key=PM10, value_fn=to_int, ), WeatherSensorEntityDescription( key=PM25_AQI, # SensorDeviceClass.AQI takes no unit of measurement. state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.AQI, translation_key=PM25_AQI, value_fn=to_int, ), WeatherSensorEntityDescription( key=PM10_AQI, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.AQI, translation_key=PM10_AQI, value_fn=to_int, ), # --- Type10 CO2 --------------------------------------------------------- WeatherSensorEntityDescription( key=CO2, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.CO2, translation_key=CO2, value_fn=to_int, ), # --- Type11 CO ---------------------------------------------------------- WeatherSensorEntityDescription( key=CO, native_unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION, state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.CO, translation_key=CO, value_fn=to_int, ), # 0-5 level batteries (t8/t9/t10/t11) are generated from BATTERY_NON_BINARY. *BATTERY_LEVEL_SENSORS, )