ESPHome  2024.12.4
http_request_update.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include "esphome/core/helpers.h"
5 
9 
10 #ifdef USE_ESP32
11 #include <freertos/FreeRTOS.h>
12 #endif
13 
14 namespace esphome {
15 namespace http_request {
16 
18  public:
19  void setup() override;
20  void update() override;
21 
22  void perform(bool force) override;
23  void check() override { this->update(); }
24 
25  void set_source_url(const std::string &source_url) { this->source_url_ = source_url; }
26 
27  void set_request_parent(HttpRequestComponent *request_parent) { this->request_parent_ = request_parent; }
28  void set_ota_parent(OtaHttpRequestComponent *ota_parent) { this->ota_parent_ = ota_parent; }
29 
30  float get_setup_priority() const override { return setup_priority::AFTER_WIFI; }
31 
32  protected:
35  std::string source_url_;
36 
37  static void update_task(void *params);
38 #ifdef USE_ESP32
39  TaskHandle_t update_task_handle_{nullptr};
40 #endif
41 };
42 
43 } // namespace http_request
44 } // namespace esphome
const float AFTER_WIFI
For components that should be initialized after WiFi is connected.
Definition: component.cpp:26
This class simplifies creating components that periodically check a state.
Definition: component.h:283
void set_ota_parent(OtaHttpRequestComponent *ota_parent)
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_source_url(const std::string &source_url)
void set_request_parent(HttpRequestComponent *request_parent)