1 """Support for Kaiterra Air Quality Sensors."""
3 from __future__
import annotations
24 async_add_entities: AddEntitiesCallback,
25 discovery_info: DiscoveryInfoType |
None =
None,
27 """Set up the air_quality kaiterra sensor."""
28 if discovery_info
is None:
31 api = hass.data[DOMAIN]
32 name = discovery_info[CONF_NAME]
33 device_id = discovery_info[CONF_DEVICE_ID]
39 """Implementation of a Kaittera air quality sensor."""
41 _attr_should_poll =
False
44 """Initialize the sensor."""
46 self.
_name_name = f
"{name} Air Quality"
58 """Return the availability of the sensor."""
59 return self.
_api_api.data.get(self.
_device_id_device_id)
is not None
63 """Return the name of the sensor."""
64 return self.
_name_name
68 """Return the Air Quality Index (AQI)."""
69 return self.
_data_data(
"aqi")
73 """Return the Air Quality Index level."""
74 return self.
_data_data(
"aqi_level")
78 """Return the Air Quality Index level."""
79 return self.
_data_data(
"aqi_pollutant")
83 """Return the particulate matter 2.5 level."""
84 return self.
_data_data(
"rpm25c")
88 """Return the particulate matter 10 level."""
89 return self.
_data_data(
"rpm10c")
93 """Return the CO2 (carbon dioxide) level."""
94 return self.
_data_data(
"rco2")
98 """Return the VOC (Volatile Organic Compounds) level."""
99 return self.
_data_data(
"rtvoc")
103 """Return the sensor's unique id."""
104 return f
"{self._device_id}_air_quality"
108 """Return the device state attributes."""
120 """Register callback."""
def particulate_matter_2_5(self)
def extra_state_attributes(self)
def air_quality_index_level(self)
def __init__(self, api, name, device_id)
def air_quality_index(self)
def particulate_matter_10(self)
def volatile_organic_compounds(self)
def air_quality_index_pollutant(self)
def async_added_to_hass(self)
None async_write_ha_state(self)
None async_on_remove(self, CALLBACK_TYPE func)
web.Response get(self, web.Request request, str config_key)
None async_setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback async_add_entities, DiscoveryInfoType|None discovery_info=None)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)