ESPHome 2025.5.0
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 {
5namespace copy {
6
7static const char *const TAG = "copy.text";
8
10 source_->add_on_state_callback([this](const std::string &value) { this->publish_state(value); });
11
12 if (source_->has_state())
14}
15
16void CopyText::dump_config() { LOG_TEXT("", "Copy Text", this); }
17
18void CopyText::control(const std::string &value) {
19 auto call2 = source_->make_call();
20 call2.set_value(value);
21 call2.perform();
22}
23
24} // namespace copy
25} // namespace esphome
text::Text * source_
Definition copy_text.h:19
void setup() override
Definition copy_text.cpp:9
void dump_config() override
Definition copy_text.cpp:16
void control(const std::string &value) override
Definition copy_text.cpp:18
TextCall & set_value(const std::string &value)
Definition text_call.cpp:10
void publish_state(const std::string &state)
Definition text.cpp:9
TextCall make_call()
Instantiate a TextCall object to modify this text component's state.
Definition text.h:35
void add_on_state_callback(std::function< void(std::string)> &&callback)
Definition text.cpp:21
bool has_state() const
Return whether this text input has gotten a full state yet.
Definition text.h:32
std::string state
Definition text.h:26
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7