SHT3XD Temperature/Humidity Sensor

The SHT3XD component allows you to use your SHT3x-DIS i2c-enabled temperature+humidity+gas sensor with esphomelib (datasheet, adafruit). It requires i2c to be setup to work.

Example Usage

// Basic
auto sht3xd = App.make_sht3xd_sensor("SHT31D Temperature", "SHT31D Humidity");

See Application::make_sht3xd_sensor().

API Reference

class SHT3XDComponent : public PollingComponent, public I2CDevice

This class implements support for the SHT3x-DIS family of temperature+humidity i2c sensors.

Public Functions

SHT3XDComponent(I2CComponent *parent, const std::string &temperature_name, const std::string &humidity_name, uint8_t address = 0x44, uint32_t update_interval = 15000)
SHT3XDTemperatureSensor *get_temperature_sensor() const
SHT3XDHumiditySensor *get_humidity_sensor() const
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()

Protected Functions

bool write_command(uint16_t command)
bool read_data(uint16_t *data, uint8_t len)

Protected Attributes

SHT3XDTemperatureSensor *temperature_sensor_
SHT3XDHumiditySensor *humidity_sensor_
class SHT3XDTemperatureSensor : public sensor::EmptyPollingParentSensor<1, ICON_EMPTY, UNIT_C, SHT3XDComponent>

Helper class exposing an SHT3xD temperature sensor with a unique id.

Public Functions

SHT3XDTemperatureSensor(const std::string &name, SHT3XDComponent *parent)
std::string unique_id()

A unique ID for this sensor, empty for no unique id.

See unique ID requirements: https://developers.home-assistant.io/docs/en/entity_registry_index.html#unique-id-requirements

Return
The unique id as a string.

Protected Attributes

friend sensor::SHT3XDTemperatureSensor::SHT3XDComponent
std::string unique_id_
class SHT3XDHumiditySensor : public sensor::EmptyPollingParentSensor<1, ICON_WATER_PERCENT, UNIT_PERCENT, SHT3XDComponent>

Helper class exposing an SHT3xD humidity sensor with a unique id.

Public Functions

SHT3XDHumiditySensor(const std::string &name, SHT3XDComponent *parent)
std::string unique_id()

A unique ID for this sensor, empty for no unique id.

See unique ID requirements: https://developers.home-assistant.io/docs/en/entity_registry_index.html#unique-id-requirements

Return
The unique id as a string.

Protected Attributes

friend sensor::SHT3XDHumiditySensor::SHT3XDComponent
std::string unique_id_