ESPHome 2025.5.0
Loading...
Searching...
No Matches
automation.h
Go to the documentation of this file.
1#pragma once
2#include "ota_http_request.h"
3
5
6namespace esphome {
7namespace http_request {
8
9template<typename... Ts> class OtaHttpRequestComponentFlashAction : public Action<Ts...> {
10 public:
12 TEMPLATABLE_VALUE(std::string, md5_url)
13 TEMPLATABLE_VALUE(std::string, md5)
14 TEMPLATABLE_VALUE(std::string, password)
15 TEMPLATABLE_VALUE(std::string, url)
16 TEMPLATABLE_VALUE(std::string, username)
17
18 void play(Ts... x) override {
19 if (this->md5_url_.has_value()) {
20 this->parent_->set_md5_url(this->md5_url_.value(x...));
21 }
22 if (this->md5_.has_value()) {
23 this->parent_->set_md5(this->md5_.value(x...));
24 }
25 if (this->password_.has_value()) {
26 this->parent_->set_password(this->password_.value(x...));
27 }
28 if (this->username_.has_value()) {
29 this->parent_->set_username(this->username_.value(x...));
30 }
31 this->parent_->set_url(this->url_.value(x...));
32
33 this->parent_->flash();
34 // Normally never reached due to reboot
35 }
36
37 protected:
38 OtaHttpRequestComponent *parent_;
39};
40
41} // namespace http_request
42} // namespace esphome
virtual void play(Ts... x)=0
OtaHttpRequestComponentFlashAction(OtaHttpRequestComponent *parent)
Definition automation.h:11
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
uint16_t x
Definition tt21100.cpp:5