ESPHome
2024.12.2
esphome
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
6
namespace
esphome
{
7
namespace
version
{
8
9
static
const
char
*
const
TAG =
"version.text_sensor"
;
10
11
void
VersionTextSensor::setup
() {
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
}
18
float
VersionTextSensor::get_setup_priority
()
const
{
return
setup_priority::DATA
; }
19
void
VersionTextSensor::set_hide_timestamp
(
bool
hide_timestamp) { this->
hide_timestamp_
= hide_timestamp; }
20
std::string
VersionTextSensor::unique_id
() {
return
get_mac_address
() +
"-version"
; }
21
void
VersionTextSensor::dump_config
() { LOG_TEXT_SENSOR(
""
,
"Version Text Sensor"
,
this
); }
22
23
}
// namespace version
24
}
// namespace esphome
esphome::shelly_dimmer::version
uint8_t version
Definition:
stm32flash.h:93
version_text_sensor.h
esphome::version::VersionTextSensor::hide_timestamp_
bool hide_timestamp_
Definition:
version_text_sensor.h:18
esphome::setup_priority::DATA
const float DATA
For components that import data from directly connected sensors like DHT.
Definition:
component.cpp:19
esphome::version::VersionTextSensor::unique_id
std::string unique_id() override
Definition:
version_text_sensor.cpp:20
application.h
esphome::version::VersionTextSensor::get_setup_priority
float get_setup_priority() const override
Definition:
version_text_sensor.cpp:18
esphome::text_sensor::TextSensor::publish_state
void publish_state(const std::string &state)
Definition:
text_sensor.cpp:9
esphome::version::VersionTextSensor::dump_config
void dump_config() override
Definition:
version_text_sensor.cpp:21
esphome::get_mac_address
std::string get_mac_address()
Get the device MAC address as a string, in lowercase hex notation.
Definition:
helpers.cpp:723
esphome::App
Application App
Global storage of Application pointer - only one Application can exist.
Definition:
application.cpp:153
version.h
esphome::version::VersionTextSensor::set_hide_timestamp
void set_hide_timestamp(bool hide_timestamp)
Definition:
version_text_sensor.cpp:19
esphome::version::VersionTextSensor::setup
void setup() override
Definition:
version_text_sensor.cpp:11
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
log.h
esphome::Application::get_compilation_time
std::string get_compilation_time() const
Definition:
application.h:215
Generated by
1.8.13