Files
esphome/esphome/components/aqi/aqi_calculator_factory.h
Jas Strong 940e619481 [aqi, hm3301, pmsx003] Air Quality Index improvements (#12203)
Co-authored-by: jas <jas@asspa.in>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-12-19 13:42:11 -05:00

28 lines
528 B
C++

#pragma once
#include "caqi_calculator.h"
#include "aqi_calculator.h"
namespace esphome::aqi {
enum AQICalculatorType { CAQI_TYPE = 0, AQI_TYPE = 1 };
class AQICalculatorFactory {
public:
AbstractAQICalculator *get_calculator(AQICalculatorType type) {
if (type == 0) {
return &this->caqi_calculator_;
} else if (type == 1) {
return &this->aqi_calculator_;
}
return nullptr;
}
protected:
CAQICalculator caqi_calculator_;
AQICalculator aqi_calculator_;
};
} // namespace esphome::aqi