ESPHome
2024.12.2
esphome
esphome
components
copy
text_sensor
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
9
void
CopyTextSensor::setup
() {
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
esphome::text_sensor::TextSensor::add_on_state_callback
void add_on_state_callback(std::function< void(std::string)> callback)
Definition:
text_sensor.cpp:52
esphome::copy::CopyTextSensor::source_
text_sensor::TextSensor * source_
Definition:
copy_text_sensor.h:17
esphome::text_sensor::TextSensor::publish_state
void publish_state(const std::string &state)
Definition:
text_sensor.cpp:9
copy_text_sensor.h
esphome::text_sensor::TextSensor::has_state
bool has_state()
Definition:
text_sensor.cpp:69
esphome::copy::CopyTextSensor::dump_config
void dump_config() override
Definition:
copy_text_sensor.cpp:15
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::text_sensor::TextSensor::state
std::string state
Definition:
text_sensor.h:59
log.h
esphome::copy::CopyTextSensor::setup
void setup() override
Definition:
copy_text_sensor.cpp:9
Generated by
1.8.13