ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
htu31d.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome::htu31d {
9
11 public:
12 void setup() override;
13 void update() override;
14 void dump_config() override;
15
17 void set_humidity(sensor::Sensor *humidity) { this->humidity_ = humidity; }
18
19 void set_heater_state(bool desired);
20 bool is_heater_enabled();
21
22 protected:
23 bool reset_();
25
28};
29} // namespace esphome::htu31d
This class simplifies creating components that periodically check a state.
Definition component.h:585
void update() override
Setup (reset) the sensor and check connection.
Definition htu31d.cpp:66
uint32_t read_serial_num_()
Reads the serial number from the device and checks the CRC.
Definition htu31d.cpp:161
sensor::Sensor * temperature_
Definition htu31d.h:26
void setup() override
Resets the sensor and ensures that the devices serial number can be read over I2C.
Definition htu31d.cpp:50
sensor::Sensor * humidity_
Definition htu31d.h:27
void set_temperature(sensor::Sensor *temperature)
Dumps the configuration values.
Definition htu31d.h:16
void set_humidity(sensor::Sensor *humidity)
Definition htu31d.h:17
bool is_heater_enabled()
Checks the diagnostics register to determine if the heater is currently enabled.
Definition htu31d.cpp:191
void set_heater_state(bool desired)
Sets the heater state on or off.
Definition htu31d.cpp:211
bool reset_()
Sends a 'reset' request to the HTU31D, followed by a 15ms delay.
Definition htu31d.cpp:147
void dump_config() override
Update the sensor values (temperature+humidity).
Definition htu31d.cpp:131
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
Base-class for all sensors.
Definition sensor.h:47
static void uint32_t
uint16_t temperature
Definition sun_gtil2.cpp:12