ESPHome  2024.5.0
htu31d.h
Go to the documentation of this file.
1 #pragma once
2 
7 
8 namespace esphome {
9 namespace 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
void setup() override
Resets the sensor and ensures that the devices serial number can be read over I2C.
Definition: htu31d.cpp:75
bool reset_()
Sends a 'reset' request to the HTU31D, followed by a 15ms delay.
Definition: htu31d.cpp:174
void set_temperature(sensor::Sensor *temperature)
Dumps the configuration values.
Definition: htu31d.h:17
This class simplifies creating components that periodically check a state.
Definition: component.h:283
sensor::Sensor * humidity_
Definition: htu31d.h:30
float get_setup_priority() const override
Sets the startup priority for this component.
Definition: htu31d.cpp:267
void dump_config() override
Update the sensor values (temperature+humidity).
Definition: htu31d.cpp:158
uint32_t read_serial_num_()
Reads the serial number from the device and checks the CRC.
Definition: htu31d.cpp:188
uint16_t temperature
Definition: sun_gtil2.cpp:26
bool is_heater_enabled()
Checks the diagnostics register to determine if the heater is currently enabled.
Definition: htu31d.cpp:218
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
void set_heater_state(bool desired)
Sets the heater state on or off.
Definition: htu31d.cpp:238
void update() override
Setup (reset) the sensor and check connection.
Definition: htu31d.cpp:93
void set_humidity(sensor::Sensor *humidity)
Definition: htu31d.h:18
Base-class for all sensors.
Definition: sensor.h:57
sensor::Sensor * temperature_
Definition: htu31d.h:29
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133