DHT12 Temperature/Humidity Sensor

Example Usage

// Basic
App.make_dht12_sensor("Outside Temperature", "Outside Humidity");

See Application::make_dht12_sensor().

API Reference

using sensor::DHT12TemperatureSensor = typedef EmptyPollingParentSensor<1, ICON_EMPTY, UNIT_C>
using sensor::DHT12HumiditySensor = typedef EmptyPollingParentSensor<0, ICON_WATER_PERCENT, UNIT_PERCENT>
class DHT12Component : public PollingComponent, public I2CDevice

Public Functions

DHT12Component(I2CComponent *parent, const std::string &temperature_name, const std::string &humidity_name, uint32_t update_interval = 15000)
void setup()

Where the component’s initialization should happen.

Analogous to Arduino’s setup(). This method is guaranteed to only be called once. Defaults to doing nothing.

void dump_config()
float get_setup_priority() const

priority of setup().

higher -> executed earlier

Defaults to 0.

Return
The setup priority of this component

void update()
DHT12TemperatureSensor *get_temperature_sensor() const
DHT12HumiditySensor *get_humidity_sensor() const

Protected Functions

bool read_data_(uint8_t *data)

Protected Attributes

DHT12TemperatureSensor *temperature_sensor_
DHT12HumiditySensor *humidity_sensor_