ESPHome 2026.3.0-dev
Loading...
Searching...
No Matches
sen6x.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::sen6x {
8
10 SUB_SENSOR(pm_1_0)
11 SUB_SENSOR(pm_2_5)
12 SUB_SENSOR(pm_4_0)
13 SUB_SENSOR(pm_10_0)
14 SUB_SENSOR(temperature)
15 SUB_SENSOR(humidity)
16 SUB_SENSOR(voc)
17 SUB_SENSOR(nox)
18 SUB_SENSOR(co2)
19 SUB_SENSOR(hcho)
20
21 public:
22 float get_setup_priority() const override { return setup_priority::DATA; }
23 void setup() override;
24 void dump_config() override;
25 void update() override;
26
27 enum Sen6xType { SEN62, SEN63C, SEN65, SEN66, SEN68, SEN69C, UNKNOWN };
28
29 void set_type(const std::string &type) { sen6x_type_ = infer_type_from_product_name_(type); }
30
31 protected:
32 Sen6xType infer_type_from_product_name_(const std::string &product_name);
33
34 bool initialized_{false};
35 std::string product_name_;
36 Sen6xType sen6x_type_{UNKNOWN};
37 std::string serial_number_;
40 bool startup_complete_{false};
41};
42
43} // namespace esphome::sen6x
virtual float get_setup_priority() const
priority of setup().
Definition component.cpp:92
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:94
This class simplifies creating components that periodically check a state.
Definition component.h:527
Sen6xType infer_type_from_product_name_(const std::string &product_name)
Definition sen6x.cpp:360
uint16_t type
constexpr float DATA
For components that import data from directly connected sensors like DHT.
Definition component.h:31
uint16_t temperature
Definition sun_gtil2.cpp:12