7static const char *
const TAG =
"shtcx";
9static constexpr uint16_t SHTCX_COMMAND_SLEEP = 0xB098;
10static constexpr uint16_t SHTCX_COMMAND_WAKEUP = 0x3517;
11static constexpr uint16_t SHTCX_COMMAND_READ_ID_REGISTER = 0xEFC8;
12static constexpr uint16_t SHTCX_COMMAND_SOFT_RESET = 0x805D;
13static constexpr uint16_t SHTCX_COMMAND_POLLING_H = 0x7866;
18 return LOG_STR(
"SHTC3");
20 return LOG_STR(
"SHTC1");
22 return LOG_STR(
"UNKNOWN");
30 uint16_t device_id_register;
32 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
39 if ((device_id_register & 0x3F) == 0x07) {
40 if (device_id_register & 0x800) {
57 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
59 LOG_UPDATE_INTERVAL(
this);
67 ESP_LOGW(TAG,
"Retrying communication");
74 ESP_LOGE(TAG,
"Polling failed");
88 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
91 temperature = 175.0f * float(raw_data[0]) / 65536.0f - 45.0f;
92 humidity = 100.0f * float(raw_data[1]) / 65536.0f;
void mark_failed()
Mark this component as failed.
void status_set_warning()
ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi set_timeout)(const char *name, uint32_t timeout, std::function< void()> &&f)
Set a timeout function with a unique name.
bool status_has_warning() const
void status_clear_warning()
bool write_command(T i2c_register)
Write a command to the I2C device.
bool read_data(uint16_t *data, uint8_t len)
Read data words from I2C device.
void publish_state(float state)
Publish a new state to the front-end.
sensor::Sensor * humidity_sensor_
sensor::Sensor * temperature_sensor_
void dump_config() override
void IRAM_ATTR HOT delayMicroseconds(uint32_t us)