ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
copy_text.cpp
Go to the documentation of this file.
1#include "copy_text.h"
2#include "esphome/core/log.h"
3
4namespace esphome::copy {
5
6static const char *const TAG = "copy.text";
7
9 source_->add_on_state_callback([this](const std::string &value) { this->publish_state(value); });
10
11 if (source_->has_state())
13}
14
15void CopyText::dump_config() { LOG_TEXT("", "Copy Text", this); }
16
17void CopyText::control(const std::string &value) {
18 auto call2 = source_->make_call();
19 call2.set_value(value);
20 call2.perform();
21}
22
23} // namespace esphome::copy
bool has_state() const
text::Text * source_
Definition copy_text.h:17
void setup() override
Definition copy_text.cpp:8
void dump_config() override
Definition copy_text.cpp:15
void control(const std::string &value) override
Definition copy_text.cpp:17
TextCall & set_value(const std::string &value)
Definition text_call.cpp:9
void add_on_state_callback(F &&callback)
Definition text.h:33
void publish_state(const std::string &state)
Definition text.cpp:11
TextCall make_call()
Instantiate a TextCall object to modify this text component's state.
Definition text.h:31
std::string state
Definition text.h:23