ESPHome
2026.11.0b6
Loading...
Searching...
No Matches
esphome
components
sfa40
sfa40.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::sfa40
{
8
9
// SFA40 Datasheet: https://sensirion.com/media/documents/5B06EDD9/69F84BD8/Sensirion_Datasheet_SFA40.pdf
10
11
class
SFA40Component
final :
public
PollingComponent
,
public
sensirion_common::SensirionI2CDevice
{
12
SUB_SENSOR(formaldehyde)
13
SUB_SENSOR(
temperature
)
14
SUB_SENSOR(humidity)
15
16
public
:
17
void
setup
()
override
;
18
void
dump_config()
override
;
19
void
update()
override
;
20
21
void
set_wait_for_ready(
bool
wait_for_ready) { this->
wait_for_ready_
= wait_for_ready; }
22
23
protected
:
24
enum
ProtocolVersion
: uint8_t {
25
UNKNOWN
= 0,
26
PRODUCTION
= 1,
27
PROTOTYPE
= 2,
28
};
29
bool
detect_protocol_
();
30
ProtocolVersion
protocol_version_
{
UNKNOWN
};
31
char
device_marking_
[11]{};
32
bool
initialized_
{
false
};
33
bool
wait_for_ready_
{
true
};
34
uint64_t
serial_number_
{0};
35
};
36
37
}
// namespace esphome::sfa40
esphome::Component::setup
virtual void setup()
Where the component's initialization should happen.
Definition
component.cpp:84
esphome::PollingComponent
This class simplifies creating components that periodically check a state.
Definition
component.h:532
esphome::sensirion_common::SensirionI2CDevice
Definition
i2c_sensirion.h:22
esphome::sfa40::SFA40Component
Definition
sfa40.h:11
esphome::sfa40::SFA40Component::detect_protocol_
bool detect_protocol_()
Definition
sfa40.cpp:56
esphome::sfa40::SFA40Component::ProtocolVersion
ProtocolVersion
Definition
sfa40.h:24
esphome::sfa40::SFA40Component::PROTOTYPE
@ PROTOTYPE
Definition
sfa40.h:27
esphome::sfa40::SFA40Component::UNKNOWN
@ UNKNOWN
Definition
sfa40.h:25
esphome::sfa40::SFA40Component::PRODUCTION
@ PRODUCTION
Definition
sfa40.h:26
esphome::sfa40::SFA40Component::wait_for_ready_
bool wait_for_ready_
Definition
sfa40.h:33
esphome::sfa40::SFA40Component::initialized_
bool initialized_
Definition
sfa40.h:32
esphome::sfa40::SFA40Component::protocol_version_
ProtocolVersion protocol_version_
Definition
sfa40.h:30
esphome::sfa40::SFA40Component::serial_number_
uint64_t serial_number_
Definition
sfa40.h:34
esphome::sfa40::SFA40Component::device_marking_
char device_marking_[11]
Definition
sfa40.h:31
component.h
i2c_sensirion.h
esphome::sfa40
Definition
sfa40.cpp:5
sensor.h
temperature
uint16_t temperature
Definition
sun_gtil2.cpp:12
Generated by
1.12.0