ESPHome 2026.11.0-dev
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 public:
24 void setup() override;
25 void dump_config() override;
26 void update() override;
27
28 void start_heater(uint16_t power, uint32_t duration_ms);
29 void stop_heater();
30
31 void set_temp_sensor(sensor::Sensor *temp_sensor) { this->temp_sensor_ = temp_sensor; }
32 void set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
33
35
36 protected:
39
41 bool heater_active_{false};
42
43 bool enable_heater_();
44 bool configure_heater_(uint16_t power_level);
45 bool disable_heater_();
46 void read_data_();
48};
49
50} // namespace esphome::hdc302x
This class simplifies creating components that periodically check a state.
Definition component.h:519
HDC302x Temperature and humidity sensor.
Definition hdc302x.h:22
sensor::Sensor * humidity_sensor_
Definition hdc302x.h:38
void start_heater(uint16_t power, uint32_t duration_ms)
Definition hdc302x.cpp:64
void set_power_mode(HDC302XPowerMode power_mode)
Definition hdc302x.h:34
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Definition hdc302x.h:32
sensor::Sensor * temp_sensor_
Definition hdc302x.h:37
void set_temp_sensor(sensor::Sensor *temp_sensor)
Definition hdc302x.h:31
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
Base-class for all sensors.
Definition sensor.h:47
PowerMode power_mode
Definition msa3xx.h:3
static void uint32_t