ESPHome  2021.10.2
pmsx003.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace pmsx003 {
9 
14 };
15 
17  public:
18  PMSX003Component() = default;
19  void loop() override;
20  float get_setup_priority() const override;
21  void dump_config() override;
22 
24 
25  void set_pm_1_0_std_sensor(sensor::Sensor *pm_1_0_std_sensor);
26  void set_pm_2_5_std_sensor(sensor::Sensor *pm_2_5_std_sensor);
27  void set_pm_10_0_std_sensor(sensor::Sensor *pm_10_0_std_sensor);
28 
29  void set_pm_1_0_sensor(sensor::Sensor *pm_1_0_sensor);
30  void set_pm_2_5_sensor(sensor::Sensor *pm_2_5_sensor);
31  void set_pm_10_0_sensor(sensor::Sensor *pm_10_0_sensor);
32 
33  void set_pm_particles_03um_sensor(sensor::Sensor *pm_particles_03um_sensor);
34  void set_pm_particles_05um_sensor(sensor::Sensor *pm_particles_05um_sensor);
35  void set_pm_particles_10um_sensor(sensor::Sensor *pm_particles_10um_sensor);
36  void set_pm_particles_25um_sensor(sensor::Sensor *pm_particles_25um_sensor);
37  void set_pm_particles_50um_sensor(sensor::Sensor *pm_particles_50um_sensor);
38  void set_pm_particles_100um_sensor(sensor::Sensor *pm_particles_100um_sensor);
39 
40  void set_temperature_sensor(sensor::Sensor *temperature_sensor);
41  void set_humidity_sensor(sensor::Sensor *humidity_sensor);
42  void set_formaldehyde_sensor(sensor::Sensor *formaldehyde_sensor);
43 
44  protected:
46  void parse_data_();
47  uint16_t get_16_bit_uint_(uint8_t start_index);
48 
49  uint8_t data_[64];
50  uint8_t data_index_{0};
51  uint32_t last_transmission_{0};
53 
54  // "Standard Particle"
58 
59  // "Under Atmospheric Pressure"
63 
64  // Particle counts by size
71 
75 };
76 
77 } // namespace pmsx003
78 } // namespace esphome
sensor::Sensor * pm_10_0_sensor_
Definition: pmsx003.h:62
sensor::Sensor * pm_particles_50um_sensor_
Definition: pmsx003.h:69
sensor::Sensor * pm_1_0_std_sensor_
Definition: pmsx003.h:55
sensor::Sensor * pm_10_0_std_sensor_
Definition: pmsx003.h:57
sensor::Sensor * pm_2_5_std_sensor_
Definition: pmsx003.h:56
void set_pm_2_5_std_sensor(sensor::Sensor *pm_2_5_std_sensor)
Definition: pmsx003.cpp:12
void set_pm_particles_10um_sensor(sensor::Sensor *pm_particles_10um_sensor)
Definition: pmsx003.cpp:29
void set_pm_2_5_sensor(sensor::Sensor *pm_2_5_sensor)
Definition: pmsx003.cpp:20
sensor::Sensor * pm_particles_10um_sensor_
Definition: pmsx003.h:67
void set_pm_particles_100um_sensor(sensor::Sensor *pm_particles_100um_sensor)
Definition: pmsx003.cpp:38
sensor::Sensor * pm_particles_25um_sensor_
Definition: pmsx003.h:68
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Definition: pmsx003.cpp:45
sensor::Sensor * formaldehyde_sensor_
Definition: pmsx003.h:74
void set_type(PMSX003Type type)
Definition: pmsx003.h:23
sensor::Sensor * pm_2_5_sensor_
Definition: pmsx003.h:61
sensor::Sensor * pm_particles_03um_sensor_
Definition: pmsx003.h:65
void set_pm_10_0_std_sensor(sensor::Sensor *pm_10_0_std_sensor)
Definition: pmsx003.cpp:15
sensor::Sensor * pm_1_0_sensor_
Definition: pmsx003.h:60
float get_setup_priority() const override
Definition: pmsx003.cpp:77
sensor::Sensor * temperature_sensor_
Definition: pmsx003.h:72
uint8_t type
uint16_t get_16_bit_uint_(uint8_t start_index)
Definition: pmsx003.cpp:217
void set_pm_particles_50um_sensor(sensor::Sensor *pm_particles_50um_sensor)
Definition: pmsx003.cpp:35
optional< bool > check_byte_()
Definition: pmsx003.cpp:78
sensor::Sensor * pm_particles_05um_sensor_
Definition: pmsx003.h:66
void set_pm_1_0_sensor(sensor::Sensor *pm_1_0_sensor)
Definition: pmsx003.cpp:19
sensor::Sensor * pm_particles_100um_sensor_
Definition: pmsx003.h:70
sensor::Sensor * humidity_sensor_
Definition: pmsx003.h:73
void set_pm_particles_25um_sensor(sensor::Sensor *pm_particles_25um_sensor)
Definition: pmsx003.cpp:32
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4
Base-class for all sensors.
Definition: sensor.h:47
void set_pm_particles_03um_sensor(sensor::Sensor *pm_particles_03um_sensor)
Definition: pmsx003.cpp:23
void set_formaldehyde_sensor(sensor::Sensor *formaldehyde_sensor)
Definition: pmsx003.cpp:46
void set_pm_10_0_sensor(sensor::Sensor *pm_10_0_sensor)
Definition: pmsx003.cpp:21
void set_pm_1_0_std_sensor(sensor::Sensor *pm_1_0_std_sensor)
Definition: pmsx003.cpp:9
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: pmsx003.cpp:42
void set_pm_particles_05um_sensor(sensor::Sensor *pm_particles_05um_sensor)
Definition: pmsx003.cpp:26