9static const uint8_t HDC1080_CMD_CONFIGURATION = 0x02;
10static const uint8_t HDC1080_CMD_TEMPERATURE = 0x00;
11static const uint8_t HDC1080_CMD_HUMIDITY = 0x01;
14 const uint8_t config[2] = {0x00, 0x00};
18 ESP_LOGW(TAG,
"Failed to configure HDC1080");
24void HDC1080Component::dump_config() {
25 ESP_LOGCONFIG(TAG,
"HDC1080:");
27 LOG_UPDATE_INTERVAL(
this);
28 LOG_SENSOR(
" ",
"Temperature", this->temperature_sensor_);
29 LOG_SENSOR(
" ",
"Humidity", this->humidity_sensor_);
32void HDC1080Component::update() {
44 uint16_t raw_temperature;
45 if (this->
read(
reinterpret_cast<uint8_t *
>(&raw_temperature), 2) !=
i2c::ERROR_OK) {
51 PUBLISH_STATE(this->temperature_sensor_,
i2c::i2ctohs(raw_temperature) * 0.0025177f - 40.0f);
59 uint16_t raw_humidity;
66 PUBLISH_STATE(this->humidity_sensor_,
i2c::i2ctohs(raw_humidity) * 0.001525879f);