13static const char *
const TAG =
"wts01";
62 uint8_t calculated_checksum = 0;
64 calculated_checksum += this->
buffer_[i];
67 uint8_t received_checksum = this->
buffer_[PACKET_SIZE - 1];
68 if (calculated_checksum != received_checksum) {
69 ESP_LOGW(TAG,
"WTS01 Checksum doesn't match: 0x%02X != 0x%02X", received_checksum, calculated_checksum);
83 float temperature =
static_cast<float>(temp) + (sign *
static_cast<float>(this->
buffer_[7]) / 100.0f);
85 ESP_LOGV(TAG,
"Received new temperature: %.2f°C",
temperature);
void publish_state(float state)
Publish a new state to the front-end.
bool read_byte(uint8_t *data)
void handle_char_(uint8_t c)
uint8_t buffer_[PACKET_SIZE]
void dump_config() override
constexpr uint8_t HEADER_4
constexpr uint8_t HEADER_3
constexpr uint8_t HEADER_2
constexpr uint8_t HEADER_1
constexpr uint8_t PACKET_SIZE
Providing packet encoding functions for exchanging data with a remote host.