ESPHome 2025.5.0
Loading...
Searching...
No Matches
version_text_sensor.cpp
Go to the documentation of this file.
2#include "esphome/core/log.h"
5
6namespace esphome {
7namespace version {
8
9static const char *const TAG = "version.text_sensor";
10
12 if (this->hide_timestamp_) {
13 this->publish_state(ESPHOME_VERSION);
14 } else {
15 this->publish_state(ESPHOME_VERSION " " + App.get_compilation_time());
16 }
17}
19void VersionTextSensor::set_hide_timestamp(bool hide_timestamp) { this->hide_timestamp_ = hide_timestamp; }
20std::string VersionTextSensor::unique_id() { return get_mac_address() + "-version"; }
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:19
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
Definition helpers.cpp:726
Application App
Global storage of Application pointer - only one Application can exist.