ESPHome 2026.11.0b6
Loading...
Searching...
No Matches
mt6701_spi_field_status.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
4
5namespace esphome::mt6701_spi {
6
7ESPHOME_LOG_TAG(TAG, "mt6701_spi.text_sensor");
8
9// Indexed by Mg[1:0]; 0b11 is reserved in the datasheet
10PROGMEM_STRING_TABLE(FieldStatusStrings, "OK", "TOO_STRONG", "TOO_WEAK", "UNKNOWN");
11
13 if (!this->parent_->read_encoder())
14 return;
15 this->publish_state(
16 FieldStatusStrings::get_progmem_str(this->parent_->get_status() & 0x03, FieldStatusStrings::LAST_INDEX));
17}
18
20 LOG_TEXT_SENSOR("", "MT6701 field status", this);
21 LOG_UPDATE_INTERVAL(this);
22}
23
24} // namespace esphome::mt6701_spi
void publish_state(const std::string &state)
Definition text_sensor.h:42
ESPHOME_LOG_TAG(TAG, "mt6701_spi.binary_sensor")
PROGMEM_STRING_TABLE(FieldStatusStrings, "OK", "TOO_STRONG", "TOO_WEAK", "UNKNOWN")