ESPHome  2021.9.3
sht4x.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace sht4x {
9 
11 
13 
15 
17  public:
18  float get_setup_priority() const override { return setup_priority::DATA; }
19  void setup() override;
20  void dump_config() override;
21  void update() override;
22 
23  void set_precision_value(SHT4XPRECISION precision) { this->precision_ = precision; };
24  void set_heater_power_value(SHT4XHEATERPOWER heater_power) { this->heater_power_ = heater_power; };
25  void set_heater_time_value(SHT4XHEATERTIME heater_time) { this->heater_time_ = heater_time; };
26  void set_heater_duty_value(float duty_cycle) { this->duty_cycle_ = duty_cycle; };
27 
28  void set_temp_sensor(sensor::Sensor *temp_sensor) { this->temp_sensor_ = temp_sensor; }
29  void set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
30 
31  protected:
35  float duty_cycle_;
36 
37  void start_heater_();
38  uint8_t heater_command_;
39 
42 };
43 
44 } // namespace sht4x
45 } // namespace esphome
SHT4XHEATERPOWER heater_power_
Definition: sht4x.h:33
float get_setup_priority() const override
Definition: sht4x.h:18
const float DATA
For components that import data from directly connected sensors like DHT.
Definition: component.cpp:18
SHT4XPRECISION precision_
Definition: sht4x.h:32
This class simplifies creating components that periodically check a state.
Definition: component.h:230
void set_precision_value(SHT4XPRECISION precision)
Definition: sht4x.h:23
sensor::Sensor * temp_sensor_
Definition: sht4x.h:40
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:24
void set_heater_time_value(SHT4XHEATERTIME heater_time)
Definition: sht4x.h:25
Library based on https://github.com/miguelbalboa/rfid and adapted to ESPHome by . ...
Definition: a4988.cpp:4
void dump_config() override
Definition: sht4x.cpp:50
void set_heater_duty_value(float duty_cycle)
Definition: sht4x.h:26
Base-class for all sensors.
Definition: sensor.h:45
void set_temp_sensor(sensor::Sensor *temp_sensor)
Definition: sht4x.h:28
sensor::Sensor * humidity_sensor_
Definition: sht4x.h:41
SHT4XHEATERPOWER
Definition: sht4x.h:12
void set_humidity_sensor(sensor::Sensor *humidity_sensor)
Definition: sht4x.h:29
All components doing communication on the I2C bus should subclass I2CDevice.
Definition: i2c.h:164
SHT4XHEATERTIME heater_time_
Definition: sht4x.h:34