ESPHome  2024.10.2
sm300d2.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace sm300d2 {
9 
11  public:
12  float get_setup_priority() const override { return setup_priority::DATA; }
13 
14  void set_co2_sensor(sensor::Sensor *co2_sensor) { co2_sensor_ = co2_sensor; }
15  void set_formaldehyde_sensor(sensor::Sensor *formaldehyde_sensor) { formaldehyde_sensor_ = formaldehyde_sensor; }
16  void set_tvoc_sensor(sensor::Sensor *tvoc_sensor) { tvoc_sensor_ = tvoc_sensor; }
17  void set_pm_2_5_sensor(sensor::Sensor *pm_2_5_sensor) { pm_2_5_sensor_ = pm_2_5_sensor; }
18  void set_pm_10_0_sensor(sensor::Sensor *pm_10_0_sensor) { pm_10_0_sensor_ = pm_10_0_sensor; }
19  void set_temperature_sensor(sensor::Sensor *temperature_sensor) { temperature_sensor_ = temperature_sensor; }
20  void set_humidity_sensor(sensor::Sensor *humidity_sensor) { humidity_sensor_ = humidity_sensor; }
21 
22  void update() override;
23  void dump_config() override;
24 
25  protected:
26  uint16_t sm300d2_checksum_(uint8_t *ptr);
27 
35 };
36 
37 } // namespace sm300d2
38 } // namespace esphome
sensor::Sensor * pm_10_0_sensor_
Definition: sm300d2.h:32
sensor::Sensor * humidity_sensor_
Definition: sm300d2.h:34
sensor::Sensor * co2_sensor_
Definition: sm300d2.h:28
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
sensor::Sensor * pm_2_5_sensor_
Definition: sm300d2.h:31
sensor::Sensor * formaldehyde_sensor_
Definition: sm300d2.h:29
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_tvoc_sensor(sensor::Sensor *tvoc_sensor)
Definition: sm300d2.h:16
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Definition: sm300d2.h:20
void set_pm_10_0_sensor(sensor::Sensor *pm_10_0_sensor)
Definition: sm300d2.h:18
void set_pm_2_5_sensor(sensor::Sensor *pm_2_5_sensor)
Definition: sm300d2.h:17
uint16_t sm300d2_checksum_(uint8_t *ptr)
Definition: sm300d2.cpp:87
void set_formaldehyde_sensor(sensor::Sensor *formaldehyde_sensor)
Definition: sm300d2.h:15
float get_setup_priority() const override
Definition: sm300d2.h:12
void dump_config() override
Definition: sm300d2.cpp:95
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
Base-class for all sensors.
Definition: sensor.h:57
void set_co2_sensor(sensor::Sensor *co2_sensor)
Definition: sm300d2.h:14
sensor::Sensor * temperature_sensor_
Definition: sm300d2.h:33
sensor::Sensor * tvoc_sensor_
Definition: sm300d2.h:30
void set_temperature_sensor(sensor::Sensor *temperature_sensor)
Definition: sm300d2.h:19