ESPHome 2025.10.0-dev
Loading...
Searching...
No Matches
version_text_sensor.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
6
7namespace esphome {
8namespace version {
9
10static const char *const TAG = "version.text_sensor";
11
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}
20void VersionTextSensor::set_hide_timestamp(bool hide_timestamp) { this->hide_timestamp_ = hide_timestamp; }
21void VersionTextSensor::dump_config() { LOG_TEXT_SENSOR("", "Version Text Sensor", this); }
22
23} // namespace version
24} // namespace esphome
std::string get_compilation_time() const
void publish_state(const std::string &state)
void set_hide_timestamp(bool hide_timestamp)
const float DATA
For components that import data from directly connected sensors like DHT.
Definition component.cpp:49
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string str_sprintf(const char *fmt,...)
Definition helpers.cpp:221
Application App
Global storage of Application pointer - only one Application can exist.