ESPHome 2025.8.0b1
Loading...
Searching...
No Matches
update_entity.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
7
8namespace esphome {
9namespace update {
10
11struct UpdateInfo {
12 std::string latest_version;
13 std::string current_version;
14 std::string title;
15 std::string summary;
16 std::string release_url;
17 std::string firmware_url;
18 std::string md5;
19 bool has_progress{false};
20 float progress;
21};
22
29
31 public:
32 void publish_state();
33
34 void perform() { this->perform(false); }
35 virtual void perform(bool force) = 0;
36 virtual void check() = 0;
37
40
41 void add_on_state_callback(std::function<void()> &&callback) { this->state_callback_.add(std::move(callback)); }
44 update_available_trigger_ = std::make_unique<Trigger<const UpdateInfo &>>();
45 }
46 return update_available_trigger_.get();
47 }
48
49 protected:
52
54 std::unique_ptr<Trigger<const UpdateInfo &>> update_available_trigger_{nullptr};
55};
56
57} // namespace update
58} // namespace esphome
std::unique_ptr< Trigger< const UpdateInfo & > > update_available_trigger_
const UpdateState & state
Trigger< const UpdateInfo & > * get_update_available_trigger()
CallbackManager< void()> state_callback_
virtual void perform(bool force)=0
void add_on_state_callback(std::function< void()> &&callback)
const UpdateInfo & update_info
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7