ESPHome 2026.4.0-dev
Loading...
Searching...
No Matches
text_text_sensor.cpp
Go to the documentation of this file.
1#include "text_text_sensor.h"
2#include "esphome/core/log.h"
3
4namespace esphome::text {
5
6static const char *const TAG = "text.text_sensor";
7
9 this->source_->add_on_state_callback([this](const std::string &value) { this->publish_state(value); });
10 if (this->source_->has_state())
11 this->publish_state(this->source_->state);
12}
13
14void TextTextSensor::dump_config() { LOG_TEXT_SENSOR("", "Text Text Sensor", this); }
15
16} // namespace esphome::text
bool has_state() const
void add_on_state_callback(F &&callback)
Definition text.h:33
std::string state
Definition text.h:23
void publish_state(const std::string &state)
const char *const TAG
Definition spi.cpp:7