ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
aqi_sensor.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::aqi {
8
9class AQISensor final : public sensor::Sensor, public Component {
10 SUB_SENSOR(pm_2_5)
11 SUB_SENSOR(pm_10_0)
12
13 public:
14 void setup() override;
15 void dump_config() override;
16
17 void set_aqi_calculation_type(AQICalculatorType type) { this->aqi_calc_type_ = type; }
18 void set_extended_range(bool extended_range) { this->extended_range_ = extended_range; }
19
20 protected:
21 void calculate_aqi_();
22
24 bool extended_range_{false};
26
27 float pm_2_5_value_{NAN};
28 float pm_10_0_value_{NAN};
29};
30
31} // namespace esphome::aqi
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
AQICalculatorType aqi_calc_type_
Definition aqi_sensor.h:23
AQICalculatorFactory aqi_calculator_factory_
Definition aqi_sensor.h:25
Base-class for all sensors.
Definition sensor.h:48
uint8_t type