ESPHome  2024.11.0
scd4x.h
Go to the documentation of this file.
1 #pragma once
2 #include <vector>
7 
8 namespace esphome {
9 namespace scd4x {
10 
11 enum ERRORCODE {
17 };
19 
21  public:
22  float get_setup_priority() const override { return setup_priority::DATA; }
23  void setup() override;
24  void dump_config() override;
25  void update() override;
26 
27  void set_automatic_self_calibration(bool asc) { enable_asc_ = asc; }
29  void set_ambient_pressure_compensation(float pressure_in_hpa);
31  void set_temperature_offset(float offset) { temperature_offset_ = offset; };
32 
35  void set_humidity_sensor(sensor::Sensor *humidity) { humidity_sensor_ = humidity; }
37  bool perform_forced_calibration(uint16_t current_co2_concentration);
38  bool factory_reset();
39 
40  protected:
41  bool update_ambient_pressure_compensation_(uint16_t pressure_in_hpa);
42  bool start_measurement_();
44 
45  bool initialized_{false};
46 
56  // used for compensation
58 };
59 
60 } // namespace scd4x
61 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
sensor::Sensor * co2_sensor_
Definition: scd4x.h:53
void set_measurement_mode(MeasurementMode mode)
Definition: scd4x.h:36
void set_ambient_pressure_compensation(float pressure_in_hpa)
Definition: scd4x.cpp:257
float altitude
Definition: qmp6988.h:73
sensor::Sensor * temperature_sensor_
Definition: scd4x.h:54
void dump_config() override
Definition: scd4x.cpp:93
void set_co2_sensor(sensor::Sensor *co2)
Definition: scd4x.h:33
uint8_t pressure
Definition: tt21100.cpp:19
bool perform_forced_calibration(uint16_t current_co2_concentration)
Definition: scd4x.cpp:205
void set_automatic_self_calibration(bool asc)
Definition: scd4x.h:27
sensor::Sensor * ambient_pressure_source_
Definition: scd4x.h:57
This class simplifies creating components that periodically check a state.
Definition: component.h:283
MeasurementMode measurement_mode_
Definition: scd4x.h:52
void set_altitude_compensation(uint16_t altitude)
Definition: scd4x.h:28
void set_ambient_pressure_source(sensor::Sensor *pressure)
Definition: scd4x.h:30
void setup() override
Definition: scd4x.cpp:29
BedjetMode mode
BedJet operating mode.
Definition: bedjet_codec.h:183
bool update_ambient_pressure_compensation_(uint16_t pressure_in_hpa)
Definition: scd4x.cpp:273
void set_temperature_offset(float offset)
Definition: scd4x.h:31
uint16_t temperature
Definition: sun_gtil2.cpp:26
void set_temperature_sensor(sensor::Sensor *temperature)
Definition: scd4x.h:34
Implementation of a i2c functions for Sensirion sensors Sensirion data requires crc checking...
Definition: i2c_sensirion.h:17
float get_setup_priority() const override
Definition: scd4x.h:22
sensor::Sensor * humidity_sensor_
Definition: scd4x.h:55
void update() override
Definition: scd4x.cpp:146
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
uint16_t altitude_compensation_
Definition: scd4x.h:48
Base-class for all sensors.
Definition: sensor.h:57
void set_humidity_sensor(sensor::Sensor *humidity)
Definition: scd4x.h:35