ESPHome  2024.12.2
sht4x.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <cinttypes>
8 
9 namespace esphome {
10 namespace sht4x {
11 
13 
15 
17 
19  public:
20  float get_setup_priority() const override { return setup_priority::DATA; }
21  void setup() override;
22  void dump_config() override;
23  void update() override;
24 
25  void set_precision_value(SHT4XPRECISION precision) { this->precision_ = precision; };
26  void set_heater_power_value(SHT4XHEATERPOWER heater_power) { this->heater_power_ = heater_power; };
27  void set_heater_time_value(SHT4XHEATERTIME heater_time) { this->heater_time_ = heater_time; };
28  void set_heater_duty_value(float duty_cycle) { this->duty_cycle_ = duty_cycle; };
29 
30  void set_temp_sensor(sensor::Sensor *temp_sensor) { this->temp_sensor_ = temp_sensor; }
31  void set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
32 
33  protected:
37  float duty_cycle_;
38 
39  void start_heater_();
40  uint8_t heater_command_;
41 
44 };
45 
46 } // namespace sht4x
47 } // namespace esphome
SHT4XHEATERPOWER heater_power_
Definition: sht4x.h:35
float get_setup_priority() const override
Definition: sht4x.h:20
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:19
SHT4XPRECISION precision_
Definition: sht4x.h:34
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_precision_value(SHT4XPRECISION precision)
Definition: sht4x.h:25
sensor::Sensor * temp_sensor_
Definition: sht4x.h:42
void update() override
Definition: sht4x.cpp:52
void setup() override
Definition: sht4x.cpp:18
void set_heater_power_value(SHT4XHEATERPOWER heater_power)
Definition: sht4x.h:26
void set_heater_time_value(SHT4XHEATERTIME heater_time)
Definition: sht4x.h:27
Implementation of a i2c functions for Sensirion sensors Sensirion data requires crc checking...
Definition: i2c_sensirion.h:17
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void dump_config() override
Definition: sht4x.cpp:50
void set_heater_duty_value(float duty_cycle)
Definition: sht4x.h:28
Base-class for all sensors.
Definition: sensor.h:57
void set_temp_sensor(sensor::Sensor *temp_sensor)
Definition: sht4x.h:30
sensor::Sensor * humidity_sensor_
Definition: sht4x.h:43
SHT4XHEATERPOWER
Definition: sht4x.h:14
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Definition: sht4x.h:31
SHT4XHEATERTIME heater_time_
Definition: sht4x.h:36