1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-13 14:20:29 +01:00
Daniel Dunn e80bd8ed3d
Add text component (#5336)
Co-authored-by: Maurits <maurits@vloop.nl>
Co-authored-by: mauritskorse <mauritskorse@gmail.com>
Co-authored-by: Daniel Dunn <dannydunn@eternityforest.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-10-25 22:00:32 +13:00

26 lines
583 B
C++

#include "copy_text.h"
#include "esphome/core/log.h"
namespace esphome {
namespace copy {
static const char *const TAG = "copy.text";
void CopyText::setup() {
source_->add_on_state_callback([this](const std::string &value) { this->publish_state(value); });
if (source_->has_state())
this->publish_state(source_->state);
}
void CopyText::dump_config() { LOG_TEXT("", "Copy Text", this); }
void CopyText::control(const std::string &value) {
auto call2 = source_->make_call();
call2.set_value(value);
call2.perform();
}
} // namespace copy
} // namespace esphome