ESPHome 2026.6.0-dev
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::http_request {
7
8template<typename... Ts> class OtaHttpRequestComponentFlashAction : public Action<Ts...> {
9 public:
11 TEMPLATABLE_VALUE(std::string, md5_url)
12 TEMPLATABLE_VALUE(std::string, md5)
13 TEMPLATABLE_VALUE(std::string, password)
14 TEMPLATABLE_VALUE(std::string, url)
15 TEMPLATABLE_VALUE(std::string, username)
16
17 void play(const Ts &...x) override {
18 if (this->md5_url_.has_value()) {
19 this->parent_->set_md5_url(this->md5_url_.value(x...));
20 }
21 if (this->md5_.has_value()) {
22 this->parent_->set_md5(this->md5_.value(x...));
23 }
24 if (this->password_.has_value()) {
25 this->parent_->set_password(this->password_.value(x...));
26 }
27 if (this->username_.has_value()) {
28 this->parent_->set_username(this->username_.value(x...));
29 }
30 this->parent_->set_url(this->url_.value(x...));
31
32 this->parent_->flash();
33 // Normally never reached due to reboot
34 }
35
36 protected:
37 OtaHttpRequestComponent *parent_;
38};
39
40} // namespace esphome::http_request
virtual void play(const Ts &...x)=0
OtaHttpRequestComponentFlashAction(OtaHttpRequestComponent *parent)
Definition automation.h:10
uint16_t x
Definition tt21100.cpp:5