12static constexpr size_t SENSOR_DATA_LENGTH = 9;
20 SensorData(
const uint8_t *
buffer) {
36 uint8_t
buffer[SENSOR_DATA_LENGTH];
39 ESP_LOGD(TAG,
"Read failed");
47 switch (data.status) {
52 ESP_LOGI(TAG,
"Warming up");
55 ESP_LOGI(TAG,
"Busy");
58 ESP_LOGE(TAG,
"Error");
68 if (this->
co2_ !=
nullptr) {
71 if (this->
tvoc_ !=
nullptr) {
79 if (this->
co2_ !=
nullptr) {
82 if (this->
tvoc_ !=
nullptr) {
88 ESP_LOGCONFIG(TAG,
"AMS iAQ Core:");
90 LOG_UPDATE_INTERVAL(
this);
91 LOG_SENSOR(
" ",
"CO2", this->
co2_);
92 LOG_SENSOR(
" ",
"TVOC", this->
tvoc_);
void mark_failed()
Mark this component as failed.
void status_set_warning()
void status_clear_warning()
ErrorCode write(const uint8_t *data, size_t len) const
writes an array of bytes to a device using an I2CBus
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len)
reads an array of bytes from a specific register in the I²C device
void dump_config() override
void publish_state(float state)
Publish a new state to the front-end.
@ ERROR_OK
No error found during execution of method.
ESPHOME_LOG_TAG(TAG, "iaqcore")
constexpr uint32_t encode_uint32(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint8_t byte4)
Encode a 32-bit value given four bytes in most to least significant byte order.
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.