ESPHome
2025.10.0-dev
Loading...
Searching...
No Matches
esphome
components
version
version_text_sensor.cpp
Go to the documentation of this file.
1
#include "
version_text_sensor.h
"
2
#include "
esphome/core/log.h
"
3
#include "
esphome/core/application.h
"
4
#include "
esphome/core/version.h
"
5
#include "
esphome/core/helpers.h
"
6
7
namespace
esphome
{
8
namespace
version {
9
10
static
const
char
*
const
TAG =
"version.text_sensor"
;
11
12
void
VersionTextSensor::setup
() {
13
if
(this->
hide_timestamp_
) {
14
this->
publish_state
(ESPHOME_VERSION);
15
}
else
{
16
this->
publish_state
(
str_sprintf
(ESPHOME_VERSION
" %s"
,
App
.
get_compilation_time
().c_str()));
17
}
18
}
19
float
VersionTextSensor::get_setup_priority
()
const
{
return
setup_priority::DATA
; }
20
void
VersionTextSensor::set_hide_timestamp
(
bool
hide_timestamp) { this->
hide_timestamp_
= hide_timestamp; }
21
void
VersionTextSensor::dump_config
() { LOG_TEXT_SENSOR(
""
,
"Version Text Sensor"
,
this
); }
22
23
}
// namespace version
24
}
// namespace esphome
application.h
esphome::Application::get_compilation_time
std::string get_compilation_time() const
Definition
application.h:251
esphome::text_sensor::TextSensor::publish_state
void publish_state(const std::string &state)
Definition
text_sensor.cpp:25
esphome::version::VersionTextSensor::hide_timestamp_
bool hide_timestamp_
Definition
version_text_sensor.h:17
esphome::version::VersionTextSensor::setup
void setup() override
Definition
version_text_sensor.cpp:12
esphome::version::VersionTextSensor::set_hide_timestamp
void set_hide_timestamp(bool hide_timestamp)
Definition
version_text_sensor.cpp:20
esphome::version::VersionTextSensor::dump_config
void dump_config() override
Definition
version_text_sensor.cpp:21
esphome::version::VersionTextSensor::get_setup_priority
float get_setup_priority() const override
Definition
version_text_sensor.cpp:19
helpers.h
log.h
esphome::setup_priority::DATA
const float DATA
For components that import data from directly connected sensors like DHT.
Definition
component.cpp:49
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
esphome::str_sprintf
std::string str_sprintf(const char *fmt,...)
Definition
helpers.cpp:221
esphome::App
Application App
Global storage of Application pointer - only one Application can exist.
Definition
application.cpp:625
version.h
version_text_sensor.h
Generated by
1.12.0