ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
cm1106.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::cm1106 {
8
9// ABC logic requested at boot; CM1106_ABC_NONE means nothing is sent and the
10// sensor keeps its stored setting.
16
18 SUB_SENSOR(co2)
19
20 public:
21 void setup() override;
22 void update() override;
23 void dump_config() override;
24
25 void calibrate_zero(uint16_t ppm);
26 void abc_enable() { this->abc_set_(true); }
27 void abc_disable() { this->abc_set_(false); }
28
29 void set_abc(bool enabled, uint8_t cycle_days, uint16_t baseline_ppm) {
31 this->abc_cycle_ = cycle_days;
32 this->abc_baseline_ = baseline_ppm;
33 }
34
35 protected:
36 bool cm1106_write_command_(const uint8_t *command, size_t command_len, uint8_t *response, size_t response_len);
38 bool send_command_expect_ack_(const uint8_t *command, size_t command_len, const uint8_t *ack);
39 void abc_set_(bool enabled);
40
42 uint8_t abc_cycle_{15};
43 uint16_t abc_baseline_{400};
44};
45
46} // namespace esphome::cm1106
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
This class simplifies creating components that periodically check a state.
Definition component.h:532
bool send_command_expect_ack_(const uint8_t *command, size_t command_len, const uint8_t *ack)
Sends a command and checks the sensor's four byte acknowledgement, updating the warning status.
Definition cm1106.cpp:99
void abc_set_(bool enabled)
Definition cm1106.cpp:86
CM1106ABCLogic abc_boot_logic_
Definition cm1106.h:41
bool cm1106_write_command_(const uint8_t *command, size_t command_len, uint8_t *response, size_t response_len)
Definition cm1106.cpp:116
@ CM1106_ABC_ENABLED
Definition cm1106.h:13
@ CM1106_ABC_DISABLED
Definition cm1106.h:14
uint8_t ack