mirror of
https://github.com/esphome/esphome.git
synced 2025-09-09 06:42:20 +01:00
CCS811 env_data
This commit is contained in:
@@ -13,6 +13,8 @@ class CCS811Component : public PollingComponent, public i2c::I2CDevice {
|
||||
void set_co2(sensor::Sensor *co2) { co2_ = co2; }
|
||||
void set_tvoc(sensor::Sensor *tvoc) { tvoc_ = tvoc; }
|
||||
void set_baseline(uint16_t baseline) { baseline_ = baseline; }
|
||||
void set_humidity(sensor::Sensor *humidity) { humidity_ = humidity; }
|
||||
void set_temperature(sensor::Sensor *temperature) { temperature_ = temperature; }
|
||||
|
||||
/// Setup the sensor and test for a connection.
|
||||
void setup() override;
|
||||
@@ -28,6 +30,7 @@ class CCS811Component : public PollingComponent, public i2c::I2CDevice {
|
||||
bool status_has_error_() { return this->read_status_().value_or(1) & 1; }
|
||||
bool status_app_is_valid_() { return this->read_status_().value_or(0) & (1 << 4); }
|
||||
bool status_has_data_() { return this->read_status_().value_or(0) & (1 << 3); }
|
||||
void send_env_data_();
|
||||
|
||||
enum ErrorCode {
|
||||
UNKNOWN,
|
||||
@@ -41,6 +44,10 @@ class CCS811Component : public PollingComponent, public i2c::I2CDevice {
|
||||
sensor::Sensor *co2_{nullptr};
|
||||
sensor::Sensor *tvoc_{nullptr};
|
||||
optional<uint16_t> baseline_{};
|
||||
/// Input sensor for humidity reading.
|
||||
sensor::Sensor *humidity_{nullptr};
|
||||
/// Input sensor for temperature reading.
|
||||
sensor::Sensor *temperature_{nullptr};
|
||||
};
|
||||
|
||||
} // namespace ccs811
|
||||
|
Reference in New Issue
Block a user