ESPHome 2025.5.0
Loading...
Searching...
No Matches
ota_esphome.h
Go to the documentation of this file.
1#pragma once
2
4#ifdef USE_OTA
9
10namespace esphome {
11
14 public:
15#ifdef USE_OTA_PASSWORD
16 void set_auth_password(const std::string &password) { password_ = password; }
17#endif // USE_OTA_PASSWORD
18
20 void set_port(uint16_t port);
21
22 void setup() override;
23 void dump_config() override;
24 float get_setup_priority() const override;
25 void loop() override;
26
27 uint16_t get_port() const;
28
29 protected:
30 void handle_();
31 bool readall_(uint8_t *buf, size_t len);
32 bool writeall_(const uint8_t *buf, size_t len);
33
34#ifdef USE_OTA_PASSWORD
35 std::string password_;
36#endif // USE_OTA_PASSWORD
37
38 uint16_t port_;
39
40 std::unique_ptr<socket::Socket> server_;
41 std::unique_ptr<socket::Socket> client_;
42};
43
44} // namespace esphome
45#endif
ESPHomeOTAComponent provides a simple way to integrate Over-the-Air updates into your app using Ardui...
Definition ota_esphome.h:13
bool writeall_(const uint8_t *buf, size_t len)
void set_auth_password(const std::string &password)
Definition ota_esphome.h:16
float get_setup_priority() const override
bool readall_(uint8_t *buf, size_t len)
void set_port(uint16_t port)
Manually set the port OTA should listen on.
std::unique_ptr< socket::Socket > server_
Definition ota_esphome.h:40
std::unique_ptr< socket::Socket > client_
Definition ota_esphome.h:41
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:301