12static constexpr uint32_t MEASUREMENT_TIMEOUT_ID = 0;
14static const uint8_t REQUEST_CMD[1] = {0x00};
15static const uint16_t MAX_COUNT = 0x3FFE;
17void HoneywellHIComponent::read_sensor_data_() {
25 const uint16_t raw_humidity = (
static_cast<uint16_t
>(data[0] & 0x3F) << 8) | data[1];
26 float humidity = (
static_cast<float>(raw_humidity) / MAX_COUNT) * 100;
28 const uint16_t raw_temperature = (
static_cast<uint16_t
>(data[2]) << 6) | (data[3] >> 2);
29 float temperature = (
static_cast<float>(raw_temperature) / MAX_COUNT) * 165 - 40;
31 ESP_LOGD(TAG,
"Got temperature=%.2f°C humidity=%.2f%%",
temperature, humidity);
38void HoneywellHIComponent::start_measurement_() {
47bool HoneywellHIComponent::is_measurement_ready_() {
56 return ((data[0] & 0xC0) == 0x00);
59void HoneywellHIComponent::measurement_timeout_() {
65 ESP_LOGV(TAG,
"Update Honeywell HIH Sensor");
67 this->start_measurement_();
69 this->
set_timeout(MEASUREMENT_TIMEOUT_ID, 100, [
this] { this->measurement_timeout_(); });
76 this->read_sensor_data_();
81 ESP_LOGD(TAG,
"Honeywell HIH:");
85 LOG_UPDATE_INTERVAL(
this);