ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
http_request_update.h
Go to the documentation of this file.
1#pragma once
2
5
9
10#ifdef USE_ESP32
11#include <freertos/FreeRTOS.h>
12#endif
13
14namespace esphome::http_request {
15
17 public:
18 void setup() override;
19 void update() override;
20
21 void perform(bool force) override;
22 void check() override { this->update(); }
23
24 void set_source_url(const std::string &source_url) { this->source_url_ = source_url; }
25
26 void set_request_parent(HttpRequestComponent *request_parent) { this->request_parent_ = request_parent; }
27 void set_ota_parent(OtaHttpRequestComponent *ota_parent) { this->ota_parent_ = ota_parent; }
28
29 float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
30
31 void on_ota_state(ota::OTAState state, float progress, uint8_t error) override;
32
33 protected:
36 std::string source_url_;
37
38 static void update_task(void *params);
39#ifdef USE_ESP32
40 TaskHandle_t update_task_handle_{nullptr};
41#endif
43};
44
45} // namespace esphome::http_request
This class simplifies creating components that periodically check a state.
Definition component.h:585
void set_source_url(const std::string &source_url)
void set_request_parent(HttpRequestComponent *request_parent)
void set_ota_parent(OtaHttpRequestComponent *ota_parent)
void on_ota_state(ota::OTAState state, float progress, uint8_t error) override
Listener interface for OTA state changes.
Definition ota_backend.h:71
const UpdateState & state
constexpr float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition component.h:53