ESPHome
2026.3.0-dev
Loading...
Searching...
No Matches
esphome
components
sen6x
sen6x.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/component.h
"
4
#include "
esphome/components/sensor/sensor.h
"
5
#include "
esphome/components/sensirion_common/i2c_sensirion.h
"
6
7
namespace
esphome::sen6x
{
8
9
class
SEN6XComponent
:
public
PollingComponent
,
public
sensirion_common::SensirionI2CDevice
{
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_
;
38
uint8_t
firmware_version_major_
{0};
39
uint8_t
firmware_version_minor_
{0};
40
bool
startup_complete_
{
false
};
41
};
42
43
}
// namespace esphome::sen6x
esphome::Component::get_setup_priority
virtual float get_setup_priority() const
priority of setup().
Definition
component.cpp:92
esphome::Component::setup
virtual void setup()
Where the component's initialization should happen.
Definition
component.cpp:94
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition
component.h:527
esphome::sen6x::SEN6XComponent
Definition
sen6x.h:9
esphome::sen6x::SEN6XComponent::startup_complete_
bool startup_complete_
Definition
sen6x.h:40
esphome::sen6x::SEN6XComponent::serial_number_
std::string serial_number_
Definition
sen6x.h:37
esphome::sen6x::SEN6XComponent::product_name_
std::string product_name_
Definition
sen6x.h:35
esphome::sen6x::SEN6XComponent::sen6x_type_
Sen6xType sen6x_type_
Definition
sen6x.h:36
esphome::sen6x::SEN6XComponent::infer_type_from_product_name_
Sen6xType infer_type_from_product_name_(const std::string &product_name)
Definition
sen6x.cpp:360
esphome::sen6x::SEN6XComponent::initialized_
bool initialized_
Definition
sen6x.h:34
esphome::sen6x::SEN6XComponent::firmware_version_minor_
uint8_t firmware_version_minor_
Definition
sen6x.h:39
esphome::sen6x::SEN6XComponent::firmware_version_major_
uint8_t firmware_version_major_
Definition
sen6x.h:38
esphome::sensirion_common::SensirionI2CDevice
Definition
i2c_sensirion.h:20
component.h
type
uint16_t type
Definition
dns_server_esp32_idf.cpp:0
i2c_sensirion.h
esphome::sen6x
Definition
sen6x.cpp:8
esphome::setup_priority::DATA
constexpr float DATA
For components that import data from directly connected sensors like DHT.
Definition
component.h:31
sensor.h
temperature
uint16_t temperature
Definition
sun_gtil2.cpp:12
Generated by
1.12.0