ESPHome  2024.10.2
pm1006.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace pm1006 {
9 
11  public:
12  PM1006Component() = default;
13 
14  void set_pm_2_5_sensor(sensor::Sensor *pm_2_5_sensor) { this->pm_2_5_sensor_ = pm_2_5_sensor; }
15  void setup() override;
16  void dump_config() override;
17  void loop() override;
18  void update() override;
19 
20  float get_setup_priority() const override;
21 
22  protected:
24  void parse_data_();
25  uint16_t get_16_bit_uint_(uint8_t start_index) const;
26  uint8_t pm1006_checksum_(const uint8_t *command_data, uint8_t length) const;
27 
29 
30  uint8_t data_[20];
31  uint8_t data_index_{0};
32  uint32_t last_transmission_{0};
33 };
34 
35 } // namespace pm1006
36 } // namespace esphome
sensor::Sensor * pm_2_5_sensor_
Definition: pm1006.h:28
void dump_config() override
Definition: pm1006.cpp:16
uint16_t get_16_bit_uint_(uint8_t start_index) const
Definition: pm1006.cpp:98
This class simplifies creating components that periodically check a state.
Definition: component.h:283
float get_setup_priority() const override
Definition: pm1006.cpp:47
void set_pm_2_5_sensor(sensor::Sensor *pm_2_5_sensor)
Definition: pm1006.h:14
uint8_t pm1006_checksum_(const uint8_t *command_data, uint8_t length) const
Definition: pm1006.cpp:49
optional< bool > check_byte_() const
Definition: pm1006.cpp:57
uint16_t length
Definition: tt21100.cpp:12
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57