6static const char *
const TAG =
"aqi";
25 ESP_LOGCONFIG(TAG,
"AQI Sensor:");
27 ESP_LOGCONFIG(TAG,
" Extended Range: %s", this->
extended_range_ ?
"enabled" :
"disabled");
34 LOG_SENSOR(
" ",
"AQI",
this);
43 if (calculator ==
nullptr) {
44 ESP_LOGW(TAG,
"Unknown AQI calculator type");
void defer(const char *name, std::function< void()> &&f)
Defer a callback to the next loop() call with a const char* name.
const StringRef & get_name() const
constexpr const char * c_str() const
AbstractAQICalculator * get_calculator(AQICalculatorType type)
AQICalculatorType aqi_calc_type_
sensor::Sensor * pm_2_5_sensor_
void dump_config() override
AQICalculatorFactory aqi_calculator_factory_
sensor::Sensor * pm_10_0_sensor_
virtual uint16_t get_aqi(float pm2_5_value, float pm10_0_value, bool extended_range)=0
void add_on_state_callback(F &&callback)
Add a callback that will be called every time a filtered value arrives.
void publish_state(float state)
Publish a new state to the front-end.