21 static const uint8_t SGP40_FEATURESET = 0x0020;
22 static const uint8_t SGP40_CRC8_POLYNOMIAL = 0x31;
23 static const uint8_t SGP40_CRC8_INIT = 0xFF;
24 static const uint8_t SGP40_WORD_LEN = 2;
28 static const uint16_t SGP40_CMD_GET_SERIAL_ID = 0x3682;
29 static const uint16_t SGP40_CMD_GET_FEATURESET = 0x202f;
30 static const uint16_t SGP40_CMD_SELF_TEST = 0x280e;
31 static const uint16_t SGP40_CMD_MEASURE_RAW = 0x260F;
48 void setup()
override;
49 void update()
override;
50 void update_voc_index();
51 void dump_config()
override;
59 int16_t sensirion_init_sensors_();
60 int16_t sgp40_probe_();
63 int32_t measure_voc_index_();
64 uint8_t generate_crc_(
const uint8_t *data, uint8_t datalen);
65 uint16_t measure_raw_();
74 int32_t voc_index_ = 0;
75 uint8_t samples_read_ = 0;
76 uint8_t samples_to_stabalize_ =
static_cast<int8_t
>(VOC_ALGORITHM_INITIAL_BLACKOUT) * 2;
90 } error_code_{UNKNOWN};
const float DATA
For components that import data from directly connected sensors like DHT.
ESPPreferenceObject pref_
float get_setup_priority() const override
void set_store_baseline(bool store_baseline)
void set_humidity_sensor(sensor::Sensor *humidity)
This class simplifies creating components that periodically check a state.
Struct to hold all the states of the VOC algorithm.
SGP40Baselines baselines_storage_
struct esphome::sgp40::SGP40Baselines PACKED
Implementation of a i2c functions for Sensirion sensors Sensirion data requires crc checking...
VocAlgorithmParams voc_algorithm_params_
const uint32_t MAXIMUM_STORAGE_DIFF
const uint32_t SHORTEST_BASELINE_STORE_INTERVAL
This class implements support for the Sensirion sgp40 i2c GAS (VOC) sensors.
void set_temperature_sensor(sensor::Sensor *temperature)
Base-class for all sensors.
uint32_t seconds_since_last_store_