ESPHome
2026.4.0-dev
Loading...
Searching...
No Matches
esphome
components
text
text_sensor
text_text_sensor.cpp
Go to the documentation of this file.
1
#include "
text_text_sensor.h
"
2
#include "
esphome/core/log.h
"
3
4
namespace
esphome::text
{
5
6
static
const
char
*
const
TAG
=
"text.text_sensor"
;
7
8
void
TextTextSensor::setup
() {
9
this->
source_
->
add_on_state_callback
([
this
](
const
std::string &value) { this->
publish_state
(value); });
10
if
(this->
source_
->
has_state
())
11
this->
publish_state
(this->
source_
->
state
);
12
}
13
14
void
TextTextSensor::dump_config
() { LOG_TEXT_SENSOR(
""
,
"Text Text Sensor"
,
this
); }
15
16
}
// namespace esphome::text
esphome::EntityBase::has_state
bool has_state() const
Definition
entity_base.h:191
esphome::text::Text::add_on_state_callback
void add_on_state_callback(F &&callback)
Definition
text.h:33
esphome::text::Text::state
std::string state
Definition
text.h:23
esphome::text::TextTextSensor::dump_config
void dump_config() override
Definition
text_text_sensor.cpp:14
esphome::text::TextTextSensor::source_
Text * source_
Definition
text_text_sensor.h:16
esphome::text::TextTextSensor::setup
void setup() override
Definition
text_text_sensor.cpp:8
esphome::text_sensor::TextSensor::publish_state
void publish_state(const std::string &state)
Definition
text_sensor.cpp:21
log.h
esphome::spi::TAG
const char *const TAG
Definition
spi.cpp:7
esphome::text
Definition
automation.h:7
text_text_sensor.h
Generated by
1.12.0