ESPHome 2025.8.0
Loading...
Searching...
No Matches
senseair.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome {
9namespace senseair {
10
11enum SenseAirStatus : uint8_t {
12 FATAL_ERROR = 1 << 0,
13 OFFSET_ERROR = 1 << 1,
15 OUTPUT_ERROR = 1 << 3,
18 MEMORY_ERROR = 1 << 6,
19 RESERVED = 1 << 7
20};
21
23 public:
24 void set_co2_sensor(sensor::Sensor *co2_sensor) { co2_sensor_ = co2_sensor; }
25
26 void update() override;
27 void dump_config() override;
28
31 void abc_get_period();
32 void abc_enable();
33 void abc_disable();
34
35 protected:
36 bool senseair_write_command_(const uint8_t *command, uint8_t *response, uint8_t response_length);
37
39};
40
41template<typename... Ts> class SenseAirBackgroundCalibrationAction : public Action<Ts...> {
42 public:
44
45 void play(Ts... x) override { this->senseair_->background_calibration(); }
46
47 protected:
49};
50
51template<typename... Ts> class SenseAirBackgroundCalibrationResultAction : public Action<Ts...> {
52 public:
54
55 void play(Ts... x) override { this->senseair_->background_calibration_result(); }
56
57 protected:
59};
60
61template<typename... Ts> class SenseAirABCEnableAction : public Action<Ts...> {
62 public:
64
65 void play(Ts... x) override { this->senseair_->abc_enable(); }
66
67 protected:
69};
70
71template<typename... Ts> class SenseAirABCDisableAction : public Action<Ts...> {
72 public:
74
75 void play(Ts... x) override { this->senseair_->abc_disable(); }
76
77 protected:
79};
80
81template<typename... Ts> class SenseAirABCGetPeriodAction : public Action<Ts...> {
82 public:
84
85 void play(Ts... x) override { this->senseair_->abc_get_period(); }
86
87 protected:
89};
90
91} // namespace senseair
92} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:425
SenseAirABCDisableAction(SenseAirComponent *senseair)
Definition senseair.h:73
SenseAirABCEnableAction(SenseAirComponent *senseair)
Definition senseair.h:63
SenseAirABCGetPeriodAction(SenseAirComponent *senseair)
Definition senseair.h:83
SenseAirBackgroundCalibrationAction(SenseAirComponent *senseair)
Definition senseair.h:43
SenseAirBackgroundCalibrationResultAction(SenseAirComponent *senseair)
Definition senseair.h:53
bool senseair_write_command_(const uint8_t *command, uint8_t *response, uint8_t response_length)
Definition senseair.cpp:131
void set_co2_sensor(sensor::Sensor *co2_sensor)
Definition senseair.h:24
Base-class for all sensors.
Definition sensor.h:59
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5