ESPHome 2026.11.0b6
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:
24
25
28 SUB_SENSOR(version)
29
30
33 SUB_SENSOR(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:
79
83 optional<uint32_t> read_tvoc_();
84
88 optional<uint8_t> read_version_();
89
93 optional<uint32_t> read_resistance_();
94
98 template<size_t N> optional<std::array<uint8_t, N>> read_and_check_(uint8_t a_register);
99};
100
101} // namespace esphome::ags10
BedjetMode mode
BedJet operating mode.
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
optional< std::array< uint8_t, N > > read_and_check_(uint8_t a_register)
Read, checks and returns data from the sensor.
Definition ags10.cpp:185
ErrorCode
Last operation error code.
Definition ags10.h:72
bool set_zero_point_with_factory_defaults()
Sets zero-point with factory defaults.
Definition ags10.cpp:101
optional< uint8_t > read_version_()
Reads and returns a firmware version of AGS10.
Definition ags10.cpp:167
enum esphome::ags10::AGS10Component::ErrorCode NONE
bool set_zero_point_with_current_resistance()
Sets zero-point with current sensor resistance.
Definition ags10.cpp:103
SUB_SENSOR(tvoc) SUB_SENSOR(version) SUB_SENSOR(resistance) void setup() override
Sets TVOC sensor.
optional< uint32_t > read_resistance_()
Reads and returns the resistance of AGS10.
Definition ags10.cpp:176
optional< uint32_t > read_tvoc_()
Reads and returns value of TVOC.
Definition ags10.cpp:140
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:105
bool set_zero_point_with(uint16_t value)
Sets zero-point with the value.
Definition ags10.cpp:119
bool new_i2c_address(uint8_t newaddress)
Modifies target address of AGS10.
Definition ags10.cpp:84
void dump_config() override
Definition ags10.cpp:53
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
AGS10SetZeroPointActionMode
Definition ags10.h:9
@ CURRENT_VALUE
Definition ags10.h:13
@ FACTORY_DEFAULT
Definition ags10.h:11
uint32_t value
Definition hal.cpp:41