ESPHome  2024.10.2
scd30.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace scd30 {
9 
12  public:
14  void set_humidity_sensor(sensor::Sensor *humidity) { humidity_sensor_ = humidity; }
16  void set_automatic_self_calibration(bool asc) { enable_asc_ = asc; }
19  ambient_pressure_compensation_ = (uint16_t) (pressure * 1000);
20  }
21  void set_temperature_offset(float offset) { temperature_offset_ = offset; }
22  void set_update_interval(uint16_t interval) { update_interval_ = interval; }
23  bool force_recalibration_with_reference(uint16_t co2_reference);
25 
26  void setup() override;
27  void update();
28  void dump_config() override;
29  float get_setup_priority() const override { return setup_priority::DATA; }
30 
31  protected:
32  bool is_data_ready_();
33 
34  enum ErrorCode {
40  } error_code_{UNKNOWN};
41  bool enable_asc_{true};
42  uint16_t altitude_compensation_{0xFFFF};
44  float temperature_offset_{0.0};
45  uint16_t update_interval_{0xFFFF};
46 
50 };
51 
52 } // namespace scd30
53 } // namespace esphome
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
float altitude
Definition: qmp6988.h:73
void setup() override
Definition: scd30.cpp:28
uint8_t pressure
Definition: tt21100.cpp:19
This class implements support for the Sensirion scd30 i2c GAS (VOC and CO2eq) sensors.
Definition: scd30.h:11
void set_humidity_sensor(sensor::Sensor *humidity)
Definition: scd30.h:14
void set_temperature_sensor(sensor::Sensor *temperature)
Definition: scd30.h:15
bool force_recalibration_with_reference(uint16_t co2_reference)
Definition: scd30.cpp:210
sensor::Sensor * humidity_sensor_
Definition: scd30.h:48
sensor::Sensor * co2_sensor_
Definition: scd30.h:47
sensor::Sensor * temperature_sensor_
Definition: scd30.h:49
enum esphome::scd30::SCD30Component::ErrorCode UNKNOWN
void set_temperature_offset(float offset)
Definition: scd30.h:21
uint16_t get_forced_calibration_reference()
Definition: scd30.cpp:223
uint16_t altitude_compensation_
Definition: scd30.h:42
uint16_t temperature
Definition: sun_gtil2.cpp:26
void set_co2_sensor(sensor::Sensor *co2)
Definition: scd30.h:13
Implementation of a i2c functions for Sensirion sensors Sensirion data requires crc checking...
Definition: i2c_sensirion.h:17
void set_ambient_pressure_compensation(float pressure)
Definition: scd30.h:18
void set_update_interval(uint16_t interval)
Definition: scd30.h:22
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
uint16_t ambient_pressure_compensation_
Definition: scd30.h:43
void set_automatic_self_calibration(bool asc)
Definition: scd30.h:16
Base-class for all sensors.
Definition: sensor.h:57
void set_altitude_compensation(uint16_t altitude)
Definition: scd30.h:17
float get_setup_priority() const override
Definition: scd30.h:29
void dump_config() override
Definition: scd30.cpp:119