ESPHome  2024.6.6
update_entity.h
Go to the documentation of this file.
1 #pragma once
2 
6 
7 namespace esphome {
8 namespace update {
9 
10 struct UpdateInfo {
11  std::string latest_version;
12  std::string current_version;
13  std::string title;
14  std::string summary;
15  std::string release_url;
16  std::string firmware_url;
17  std::string md5;
18  bool has_progress{false};
19  float progress;
20 };
21 
22 enum UpdateState : uint8_t {
27 };
28 
30  public:
31  bool has_state() const { return this->has_state_; }
32 
33  void publish_state();
34 
35  virtual void perform() = 0;
36 
37  const UpdateInfo &update_info = update_info_;
38  const UpdateState &state = state_;
39 
40  void add_on_state_callback(std::function<void()> &&callback) { this->state_callback_.add(std::move(callback)); }
41 
42  protected:
45  bool has_state_{false};
46 
47  CallbackManager<void()> state_callback_{};
48 };
49 
50 } // namespace update
51 } // namespace esphome
void add_on_state_callback(std::function< void()> &&callback)
Definition: update_entity.h:40
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
bool state
Definition: fan.h:34