ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
htu21d.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::htu21d {
8
10
11class HTU21DComponent final : public PollingComponent, public i2c::I2CDevice {
12 SUB_SENSOR(temperature)
13 SUB_SENSOR(humidity)
14 SUB_SENSOR(heater)
15
16 public:
18 void setup() override;
19 void dump_config() override;
20 void set_sensor_model(HTU21DSensorModels sensor_model) { sensor_model_ = sensor_model; }
22 void update() override;
23
24 bool is_heater_enabled();
25 void set_heater(bool status);
26 void set_heater_level(uint8_t level);
27 uint8_t get_heater_level();
28
29 protected:
31};
32
33} // namespace esphome::htu21d
uint8_t status
Definition bl0942.h:8
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
HTU21DSensorModels sensor_model_
Definition htu21d.h:30
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:144
@ HTU21D_SENSOR_MODEL_SI7021
Definition htu21d.h:9
@ HTU21D_SENSOR_MODEL_SHT21
Definition htu21d.h:9
@ HTU21D_SENSOR_MODEL_HTU21D
Definition htu21d.h:9
uint16_t temperature
Definition sun_gtil2.cpp:12