ESPHome  2022.6.2
sps30.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace sps30 {
9 
13  public:
14  void set_pm_1_0_sensor(sensor::Sensor *pm_1_0) { pm_1_0_sensor_ = pm_1_0; }
15  void set_pm_2_5_sensor(sensor::Sensor *pm_2_5) { pm_2_5_sensor_ = pm_2_5; }
16  void set_pm_4_0_sensor(sensor::Sensor *pm_4_0) { pm_4_0_sensor_ = pm_4_0; }
17  void set_pm_10_0_sensor(sensor::Sensor *pm_10_0) { pm_10_0_sensor_ = pm_10_0; }
18  void set_pmc_0_5_sensor(sensor::Sensor *pmc_0_5) { pmc_0_5_sensor_ = pmc_0_5; }
19  void set_pmc_1_0_sensor(sensor::Sensor *pmc_1_0) { pmc_1_0_sensor_ = pmc_1_0; }
20  void set_pmc_2_5_sensor(sensor::Sensor *pmc_2_5) { pmc_2_5_sensor_ = pmc_2_5; }
21  void set_pmc_4_0_sensor(sensor::Sensor *pmc_4_0) { pmc_4_0_sensor_ = pmc_4_0; }
22  void set_pmc_10_0_sensor(sensor::Sensor *pmc_10_0) { pmc_10_0_sensor_ = pmc_10_0; }
23 
24  void set_pm_size_sensor(sensor::Sensor *pm_size) { pm_size_sensor_ = pm_size; }
25  void set_auto_cleaning_interval(uint32_t auto_cleaning_interval) { fan_interval_ = auto_cleaning_interval; }
26  void setup() override;
27  void update() override;
28  void dump_config() override;
29  float get_setup_priority() const override { return setup_priority::DATA; }
30 
31  bool start_fan_cleaning();
32 
33  protected:
34  char serial_number_[17] = {0};
38 
39  enum ErrorCode {
47  } error_code_{UNKNOWN};
48 
60 };
61 
62 } // namespace sps30
63 } // namespace esphome
sensor::Sensor * pm_2_5_sensor_
Definition: sps30.h:50
void setup() override
Definition: sps30.cpp:24
This class implements support for the Sensirion SPS30 i2c/UART Particulate Matter PM1...
Definition: sps30.h:12
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:18
void set_pm_2_5_sensor(sensor::Sensor *pm_2_5)
Definition: sps30.h:15
void set_pmc_0_5_sensor(sensor::Sensor *pmc_0_5)
Definition: sps30.h:18
void dump_config() override
Definition: sps30.cpp:70
sensor::Sensor * pm_size_sensor_
Definition: sps30.h:58
sensor::Sensor * pmc_10_0_sensor_
Definition: sps30.h:57
sensor::Sensor * pm_4_0_sensor_
Definition: sps30.h:51
optional< uint32_t > fan_interval_
Definition: sps30.h:59
This class simplifies creating components that periodically check a state.
Definition: component.h:266
void set_pmc_4_0_sensor(sensor::Sensor *pmc_4_0)
Definition: sps30.h:21
void set_pmc_1_0_sensor(sensor::Sensor *pmc_1_0)
Definition: sps30.h:19
sensor::Sensor * pmc_0_5_sensor_
Definition: sps30.h:53
float get_setup_priority() const override
Definition: sps30.h:29
uint16_t raw_firmware_version_
Terminating NULL character.
Definition: sps30.h:35
void set_pm_10_0_sensor(sensor::Sensor *pm_10_0)
Definition: sps30.h:17
void set_pm_4_0_sensor(sensor::Sensor *pm_4_0)
Definition: sps30.h:16
uint8_t skipped_data_read_cycles_
Definition: sps30.h:37
Implementation of a i2c functions for Sensirion sensors Sensirion data requires crc checking...
Definition: i2c_sensirion.h:15
void set_pmc_2_5_sensor(sensor::Sensor *pmc_2_5)
Definition: sps30.h:20
void update() override
Definition: sps30.cpp:113
void set_pm_size_sensor(sensor::Sensor *pm_size)
Definition: sps30.h:24
void set_pmc_10_0_sensor(sensor::Sensor *pmc_10_0)
Definition: sps30.h:22
sensor::Sensor * pmc_2_5_sensor_
Definition: sps30.h:55
Definition: a4988.cpp:4
void set_auto_cleaning_interval(uint32_t auto_cleaning_interval)
Definition: sps30.h:25
sensor::Sensor * pmc_1_0_sensor_
Definition: sps30.h:54
sensor::Sensor * pmc_4_0_sensor_
Definition: sps30.h:56
Base-class for all sensors.
Definition: sensor.h:47
void set_pm_1_0_sensor(sensor::Sensor *pm_1_0)
Definition: sps30.h:14
sensor::Sensor * pm_10_0_sensor_
Definition: sps30.h:52
sensor::Sensor * pm_1_0_sensor_
Definition: sps30.h:49
enum esphome::sps30::SPS30Component::ErrorCode UNKNOWN