ESPHome  2024.10.2
copy_text_sensor.cpp
Go to the documentation of this file.
1 #include "copy_text_sensor.h"
2 #include "esphome/core/log.h"
3 
4 namespace esphome {
5 namespace copy {
6 
7 static const char *const TAG = "copy.text_sensor";
8 
10  source_->add_on_state_callback([this](const std::string &value) { this->publish_state(value); });
11  if (source_->has_state())
12  this->publish_state(source_->state);
13 }
14 
15 void CopyTextSensor::dump_config() { LOG_TEXT_SENSOR("", "Copy Sensor", this); }
16 
17 } // namespace copy
18 } // namespace esphome
void add_on_state_callback(std::function< void(std::string)> callback)
Definition: text_sensor.cpp:52
text_sensor::TextSensor * source_
void publish_state(const std::string &state)
Definition: text_sensor.cpp:9
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7