ESPHome  2024.11.1
senseair.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 namespace esphome {
9 namespace senseair {
10 
12  public:
13  float get_setup_priority() const override { return setup_priority::DATA; }
14  void set_co2_sensor(sensor::Sensor *co2_sensor) { co2_sensor_ = co2_sensor; }
15 
16  void update() override;
17  void dump_config() override;
18 
21  void abc_get_period();
22  void abc_enable();
23  void abc_disable();
24 
25  protected:
26  bool senseair_write_command_(const uint8_t *command, uint8_t *response, uint8_t response_length);
27 
29 };
30 
31 template<typename... Ts> class SenseAirBackgroundCalibrationAction : public Action<Ts...> {
32  public:
33  SenseAirBackgroundCalibrationAction(SenseAirComponent *senseair) : senseair_(senseair) {}
34 
35  void play(Ts... x) override { this->senseair_->background_calibration(); }
36 
37  protected:
39 };
40 
41 template<typename... Ts> class SenseAirBackgroundCalibrationResultAction : public Action<Ts...> {
42  public:
44 
45  void play(Ts... x) override { this->senseair_->background_calibration_result(); }
46 
47  protected:
49 };
50 
51 template<typename... Ts> class SenseAirABCEnableAction : public Action<Ts...> {
52  public:
53  SenseAirABCEnableAction(SenseAirComponent *senseair) : senseair_(senseair) {}
54 
55  void play(Ts... x) override { this->senseair_->abc_enable(); }
56 
57  protected:
59 };
60 
61 template<typename... Ts> class SenseAirABCDisableAction : public Action<Ts...> {
62  public:
63  SenseAirABCDisableAction(SenseAirComponent *senseair) : senseair_(senseair) {}
64 
65  void play(Ts... x) override { this->senseair_->abc_disable(); }
66 
67  protected:
69 };
70 
71 template<typename... Ts> class SenseAirABCGetPeriodAction : public Action<Ts...> {
72  public:
73  SenseAirABCGetPeriodAction(SenseAirComponent *senseair) : senseair_(senseair) {}
74 
75  void play(Ts... x) override { this->senseair_->abc_get_period(); }
76 
77  protected:
79 };
80 
81 } // namespace senseair
82 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
uint16_t x
Definition: tt21100.cpp:17
This class simplifies creating components that periodically check a state.
Definition: component.h:283
SenseAirBackgroundCalibrationAction(SenseAirComponent *senseair)
Definition: senseair.h:33
float get_setup_priority() const override
Definition: senseair.h:13
void set_co2_sensor(sensor::Sensor *co2_sensor)
Definition: senseair.h:14
bool senseair_write_command_(const uint8_t *command, uint8_t *response, uint8_t response_length)
Definition: senseair.cpp:127
SenseAirABCDisableAction(SenseAirComponent *senseair)
Definition: senseair.h:63
SenseAirBackgroundCalibrationResultAction(SenseAirComponent *senseair)
Definition: senseair.h:43
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
SenseAirABCEnableAction(SenseAirComponent *senseair)
Definition: senseair.h:53
Base-class for all sensors.
Definition: sensor.h:57
SenseAirABCGetPeriodAction(SenseAirComponent *senseair)
Definition: senseair.h:73