ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
hdc302x.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::hdc302x {
8
9enum HDC302XPowerMode : uint8_t {
11 BALANCED = 0x0b,
12 LOW_POWER = 0x16,
14};
15
22class 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:
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_();
45};
46
47} // namespace esphome::hdc302x
virtual void setup()
Where the component's initialization should happen.
Definition component.cpp:84
This class simplifies creating components that periodically check a state.
Definition component.h:532
HDC302x Temperature and humidity sensor.
Definition hdc302x.h:22
bool configure_heater_(uint16_t power_level)
Definition hdc302x.cpp:95
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
PowerMode power_mode
Definition msa3xx.h:3
static void uint32_t
uint16_t temperature
Definition sun_gtil2.cpp:12