ESPHome
2026.11.0b6
Loading...
Searching...
No Matches
esphome
components
hdc302x
hdc302x.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/i2c/i2c.h
"
6
7
namespace
esphome::hdc302x
{
8
9
enum
HDC302XPowerMode
: uint8_t {
10
HIGH_ACCURACY
= 0x00,
11
BALANCED
= 0x0b,
12
LOW_POWER
= 0x16,
13
ULTRA_LOW_POWER
= 0xff,
14
};
15
22
class
HDC302XComponent
final :
public
PollingComponent
,
public
i2c::I2CDevice
{
23
SUB_SENSOR(
temperature
)
24
SUB_SENSOR(humidity)
25
26
public
:
27
void
setup
()
override
;
28
void
dump_config()
override
;
29
void
update()
override
;
30
31
void
start_heater(uint16_t power,
uint32_t
duration_ms);
32
void
stop_heater();
33
34
void
set_power_mode(
HDC302XPowerMode
power_mode
) { this->
power_mode_
=
power_mode
; }
35
36
protected
:
37
HDC302XPowerMode
power_mode_
{
HDC302XPowerMode::HIGH_ACCURACY
};
38
bool
heater_active_
{
false
};
39
40
bool
enable_heater_
();
41
bool
configure_heater_
(uint16_t power_level);
42
bool
disable_heater_
();
43
void
read_data_
();
44
uint32_t
conversion_delay_ms_
();
45
};
46
47
}
// namespace esphome::hdc302x
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::hdc302x::HDC302XComponent
HDC302x Temperature and humidity sensor.
Definition
hdc302x.h:22
esphome::hdc302x::HDC302XComponent::disable_heater_
bool disable_heater_()
Definition
hdc302x.cpp:120
esphome::hdc302x::HDC302XComponent::heater_active_
bool heater_active_
Definition
hdc302x.h:38
esphome::hdc302x::HDC302XComponent::read_data_
void read_data_()
Definition
hdc302x.cpp:128
esphome::hdc302x::HDC302XComponent::power_mode_
HDC302XPowerMode power_mode_
Definition
hdc302x.h:37
esphome::hdc302x::HDC302XComponent::enable_heater_
bool enable_heater_()
Definition
hdc302x.cpp:87
esphome::hdc302x::HDC302XComponent::conversion_delay_ms_
uint32_t conversion_delay_ms_()
Definition
hdc302x.cpp:145
esphome::hdc302x::HDC302XComponent::configure_heater_
bool configure_heater_(uint16_t power_level)
Definition
hdc302x.cpp:95
esphome::i2c::I2CDevice
This Class provides the methods to read/write bytes from/to an i2c device.
Definition
i2c.h:144
component.h
i2c.h
power_mode
PowerMode power_mode
Definition
msa3xx.h:3
esphome::hdc302x
Definition
hdc302x.cpp:7
esphome::hdc302x::HDC302XPowerMode
HDC302XPowerMode
Definition
hdc302x.h:9
esphome::hdc302x::ULTRA_LOW_POWER
@ ULTRA_LOW_POWER
Definition
hdc302x.h:13
esphome::hdc302x::BALANCED
@ BALANCED
Definition
hdc302x.h:11
esphome::hdc302x::LOW_POWER
@ LOW_POWER
Definition
hdc302x.h:12
esphome::hdc302x::HIGH_ACCURACY
@ HIGH_ACCURACY
Definition
hdc302x.h:10
uint32_t
static void uint32_t
Definition
crash_handler.cpp:153
sensor.h
temperature
uint16_t temperature
Definition
sun_gtil2.cpp:12
Generated by
1.12.0