ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
ags10.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::ags10 {
8
10 // Zero-point reset.
12 // Zero-point calibration with current resistance.
14 // Zero-point calibration with custom resistance.
16};
17
18class AGS10Component final : public PollingComponent, public i2c::I2CDevice {
19 public:
23 void set_tvoc(sensor::Sensor *tvoc) { this->tvoc_ = tvoc; }
24
28 void set_version(sensor::Sensor *version) { this->version_ = version; }
29
33 void set_resistance(sensor::Sensor *resistance) { this->resistance_ = resistance; }
34
35 void setup() override;
36
37 void update() override;
38
39 void dump_config() override;
40
46 bool new_i2c_address(uint8_t newaddress);
47
52
57
62
66 bool set_zero_point_with(uint16_t value);
67
68 protected:
73
78
83
94
98 optional<uint32_t> read_tvoc_();
99
103 optional<uint8_t> read_version_();
104
108 optional<uint32_t> read_resistance_();
109
113 template<size_t N> optional<std::array<uint8_t, N>> read_and_check_(uint8_t a_register);
114};
115
116} // namespace esphome::ags10
BedjetMode mode
BedJet operating mode.
This class simplifies creating components that periodically check a state.
Definition component.h:519
optional< std::array< uint8_t, N > > read_and_check_(uint8_t a_register)
Read, checks and returns data from the sensor.
Definition ags10.cpp:189
ErrorCode
Last operation error code.
Definition ags10.h:87
bool set_zero_point_with_factory_defaults()
Sets zero-point with factory defaults.
Definition ags10.cpp:105
optional< uint8_t > read_version_()
Reads and returns a firmware version of AGS10.
Definition ags10.cpp:171
void set_resistance(sensor::Sensor *resistance)
Sets resistance info sensor.
Definition ags10.h:33
enum esphome::ags10::AGS10Component::ErrorCode NONE
sensor::Sensor * tvoc_
TVOC.
Definition ags10.h:72
bool set_zero_point_with_current_resistance()
Sets zero-point with current sensor resistance.
Definition ags10.cpp:107
sensor::Sensor * resistance_
Resistance.
Definition ags10.h:82
void set_tvoc(sensor::Sensor *tvoc)
Sets TVOC sensor.
Definition ags10.h:23
void set_version(sensor::Sensor *version)
Sets version info sensor.
Definition ags10.h:28
optional< uint32_t > read_resistance_()
Reads and returns the resistance of AGS10.
Definition ags10.cpp:180
optional< uint32_t > read_tvoc_()
Reads and returns value of TVOC.
Definition ags10.cpp:144
void set_zero_point(AGS10SetZeroPointActionMode mode, uint16_t value)
Sets zero-point by mode; the value is only used for CUSTOM_VALUE.
Definition ags10.cpp:109
sensor::Sensor * version_
Firmvare version.
Definition ags10.h:77
bool set_zero_point_with(uint16_t value)
Sets zero-point with the value.
Definition ags10.cpp:123
bool new_i2c_address(uint8_t newaddress)
Modifies target address of AGS10.
Definition ags10.cpp:88
void dump_config() override
Definition ags10.cpp:57
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
Base-class for all sensors.
Definition sensor.h:47
AGS10SetZeroPointActionMode
Definition ags10.h:9
@ CURRENT_VALUE
Definition ags10.h:13
@ FACTORY_DEFAULT
Definition ags10.h:11