ESPHome
2025.5.0
Loading...
Searching...
No Matches
esphome
components
update
update_entity.cpp
Go to the documentation of this file.
1
#include "
update_entity.h
"
2
3
#include "
esphome/core/log.h
"
4
5
namespace
esphome
{
6
namespace
update {
7
8
static
const
char
*
const
TAG
=
"update"
;
9
10
void
UpdateEntity::publish_state
() {
11
ESP_LOGD(TAG,
"'%s' - Publishing:"
, this->
name_
.
c_str
());
12
ESP_LOGD(TAG,
" Current Version: %s"
, this->
update_info_
.
current_version
.c_str());
13
14
if
(!this->
update_info_
.
md5
.empty()) {
15
ESP_LOGD(TAG,
" Latest Version: %s"
, this->
update_info_
.
latest_version
.c_str());
16
}
17
if
(!this->
update_info_
.
firmware_url
.empty()) {
18
ESP_LOGD(TAG,
" Firmware URL: %s"
, this->
update_info_
.
firmware_url
.c_str());
19
}
20
21
ESP_LOGD(TAG,
" Title: %s"
, this->
update_info_
.
title
.c_str());
22
if
(!this->
update_info_
.
summary
.empty()) {
23
ESP_LOGD(TAG,
" Summary: %s"
, this->
update_info_
.
summary
.c_str());
24
}
25
if
(!this->
update_info_
.
release_url
.empty()) {
26
ESP_LOGD(TAG,
" Release URL: %s"
, this->
update_info_
.
release_url
.c_str());
27
}
28
29
if
(this->
update_info_
.
has_progress
) {
30
ESP_LOGD(TAG,
" Progress: %.0f%%"
, this->
update_info_
.
progress
);
31
}
32
33
this->
has_state_
=
true
;
34
this->
state_callback_
.call();
35
}
36
37
}
// namespace update
38
}
// namespace esphome
esphome::EntityBase::name_
StringRef name_
Definition
entity_base.h:56
esphome::StringRef::c_str
constexpr const char * c_str() const
Definition
string_ref.h:68
esphome::update::UpdateEntity::publish_state
void publish_state()
Definition
update_entity.cpp:10
esphome::update::UpdateEntity::update_info_
UpdateInfo update_info_
Definition
update_entity.h:46
esphome::update::UpdateEntity::state_callback_
CallbackManager< void()> state_callback_
Definition
update_entity.h:49
esphome::update::UpdateEntity::has_state_
bool has_state_
Definition
update_entity.h:47
log.h
esphome::spi::TAG
const char *const TAG
Definition
spi.cpp:8
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
esphome::update::UpdateInfo::md5
std::string md5
Definition
update_entity.h:17
esphome::update::UpdateInfo::firmware_url
std::string firmware_url
Definition
update_entity.h:16
esphome::update::UpdateInfo::release_url
std::string release_url
Definition
update_entity.h:15
esphome::update::UpdateInfo::title
std::string title
Definition
update_entity.h:13
esphome::update::UpdateInfo::summary
std::string summary
Definition
update_entity.h:14
esphome::update::UpdateInfo::current_version
std::string current_version
Definition
update_entity.h:12
esphome::update::UpdateInfo::latest_version
std::string latest_version
Definition
update_entity.h:11
esphome::update::UpdateInfo::has_progress
bool has_progress
Definition
update_entity.h:18
esphome::update::UpdateInfo::progress
float progress
Definition
update_entity.h:19
update_entity.h
Generated by
1.12.0