ESPHome
2026.1.4
Loading...
Searching...
No Matches
esphome
components
update
update_entity.cpp
Go to the documentation of this file.
1
#include "
update_entity.h
"
2
#include "
esphome/core/defines.h
"
3
#include "
esphome/core/controller_registry.h
"
4
#include "
esphome/core/log.h
"
5
6
namespace
esphome
{
7
namespace
update {
8
9
static
const
char
*
const
TAG
=
"update"
;
10
11
void
UpdateEntity::publish_state
() {
12
ESP_LOGD(TAG,
13
"'%s' >>\n"
14
" Current Version: %s"
,
15
this->
name_
.
c_str
(), this->update_info_.current_version.c_str());
16
17
if
(!this->
update_info_
.
md5
.empty()) {
18
ESP_LOGD(TAG,
" Latest Version: %s"
, this->
update_info_
.
latest_version
.c_str());
19
}
20
if
(!this->
update_info_
.
firmware_url
.empty()) {
21
ESP_LOGD(TAG,
" Firmware URL: %s"
, this->
update_info_
.
firmware_url
.c_str());
22
}
23
24
ESP_LOGD(TAG,
" Title: %s"
, this->
update_info_
.
title
.c_str());
25
if
(!this->
update_info_
.
summary
.empty()) {
26
ESP_LOGD(TAG,
" Summary: %s"
, this->
update_info_
.
summary
.c_str());
27
}
28
if
(!this->
update_info_
.
release_url
.empty()) {
29
ESP_LOGD(TAG,
" Release URL: %s"
, this->
update_info_
.
release_url
.c_str());
30
}
31
32
if
(this->
update_info_
.
has_progress
) {
33
ESP_LOGD(TAG,
" Progress: %.0f%%"
, this->
update_info_
.
progress
);
34
}
35
36
this->
set_has_state
(
true
);
37
this->
state_callback_
.call();
38
#if defined(USE_UPDATE) && defined(USE_CONTROLLER_REGISTRY)
39
ControllerRegistry::notify_update
(
this
);
40
#endif
41
}
42
43
}
// namespace update
44
}
// namespace esphome
esphome::ControllerRegistry::notify_update
static void notify_update(update::UpdateEntity *obj)
esphome::EntityBase::name_
StringRef name_
Definition
entity_base.h:157
esphome::EntityBase::set_has_state
void set_has_state(bool state)
Definition
entity_base.h:123
esphome::StringRef::c_str
constexpr const char * c_str() const
Definition
string_ref.h:73
esphome::update::UpdateEntity::publish_state
void publish_state()
Definition
update_entity.cpp:11
esphome::update::UpdateEntity::update_info_
UpdateInfo update_info_
Definition
update_entity.h:51
esphome::update::UpdateEntity::state_callback_
LazyCallbackManager< void()> state_callback_
Definition
update_entity.h:53
controller_registry.h
defines.h
log.h
esphome::spi::TAG
const char *const TAG
Definition
spi.cpp:7
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:18
esphome::update::UpdateInfo::firmware_url
std::string firmware_url
Definition
update_entity.h:17
esphome::update::UpdateInfo::release_url
std::string release_url
Definition
update_entity.h:16
esphome::update::UpdateInfo::title
std::string title
Definition
update_entity.h:14
esphome::update::UpdateInfo::summary
std::string summary
Definition
update_entity.h:15
esphome::update::UpdateInfo::latest_version
std::string latest_version
Definition
update_entity.h:12
esphome::update::UpdateInfo::has_progress
bool has_progress
Definition
update_entity.h:19
esphome::update::UpdateInfo::progress
float progress
Definition
update_entity.h:20
update_entity.h
Generated by
1.12.0