ESPHome 2025.5.0
Loading...
Searching...
No Matches
htu31d.h
Go to the documentation of this file.
1#pragma once
2
7
8namespace esphome {
9namespace htu31d {
10
12 public:
13 void setup() override;
14 void update() override;
15 void dump_config() override;
16
18 void set_humidity(sensor::Sensor *humidity) { this->humidity_ = humidity; }
19
20 void set_heater_state(bool desired);
21 bool is_heater_enabled();
22
23 float get_setup_priority() const override;
24
25 protected:
26 bool reset_();
27 uint32_t read_serial_num_();
28
31};
32} // namespace htu31d
33} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:301
void update() override
Setup (reset) the sensor and check connection.
Definition htu31d.cpp:95
uint32_t read_serial_num_()
Reads the serial number from the device and checks the CRC.
Definition htu31d.cpp:190
sensor::Sensor * temperature_
Definition htu31d.h:29
void setup() override
Resets the sensor and ensures that the devices serial number can be read over I2C.
Definition htu31d.cpp:77
float get_setup_priority() const override
Sets the startup priority for this component.
Definition htu31d.cpp:269
sensor::Sensor * humidity_
Definition htu31d.h:30
void set_temperature(sensor::Sensor *temperature)
Dumps the configuration values.
Definition htu31d.h:17
void set_humidity(sensor::Sensor *humidity)
Definition htu31d.h:18
bool is_heater_enabled()
Checks the diagnostics register to determine if the heater is currently enabled.
Definition htu31d.cpp:220
void set_heater_state(bool desired)
Sets the heater state on or off.
Definition htu31d.cpp:240
bool reset_()
Sends a 'reset' request to the HTU31D, followed by a 15ms delay.
Definition htu31d.cpp:176
void dump_config() override
Update the sensor values (temperature+humidity).
Definition htu31d.cpp:160
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
Base-class for all sensors.
Definition sensor.h:57
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t temperature
Definition sun_gtil2.cpp:12