ESPHome 2025.9.0-dev
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_handshake_();
31 void handle_data_();
32 bool readall_(uint8_t *buf, size_t len);
33 bool writeall_(const uint8_t *buf, size_t len);
34 void log_socket_error_(const char *msg);
35 void log_read_error_(const char *what);
36 void log_start_(const char *phase);
39
40#ifdef USE_OTA_PASSWORD
41 std::string password_;
42#endif // USE_OTA_PASSWORD
43
44 uint16_t port_;
46
47 std::unique_ptr<socket::Socket> server_;
48 std::unique_ptr<socket::Socket> client_;
49};
50
51} // namespace esphome
52#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 log_start_(const char *phase)
void set_auth_password(const std::string &password)
Definition ota_esphome.h:16
void log_socket_error_(const char *msg)
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:47
void log_read_error_(const char *what)
std::unique_ptr< socket::Socket > client_
Definition ota_esphome.h:48
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:279