esphome 2025.9.0b1__py3-none-any.whl → 2025.9.0b3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/__main__.py +146 -68
- esphome/components/adc/__init__.py +1 -26
- esphome/components/adc/sensor.py +20 -0
- esphome/components/ade7880/ade7880.cpp +1 -1
- esphome/components/api/api_connection.cpp +4 -11
- esphome/components/api/api_connection.h +0 -1
- esphome/components/api/api_pb2.cpp +0 -8
- esphome/components/api/api_pb2.h +0 -4
- esphome/components/api/api_pb2_dump.cpp +1 -7
- esphome/components/api/api_pb2_service.cpp +0 -14
- esphome/components/api/api_pb2_service.h +1 -3
- esphome/components/api/client.py +5 -3
- esphome/components/bluetooth_proxy/bluetooth_proxy.h +3 -1
- esphome/components/captive_portal/captive_index.h +77 -97
- esphome/components/esp32_ble/ble_uuid.cpp +30 -9
- esphome/components/esp32_ble_beacon/esp32_ble_beacon.cpp +4 -3
- esphome/components/esp32_ble_client/ble_client_base.h +8 -5
- esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp +2 -3
- esphome/components/ethernet/__init__.py +11 -0
- esphome/components/ethernet/ethernet_component.cpp +52 -2
- esphome/components/ethernet/ethernet_component.h +4 -0
- esphome/components/factory_reset/button/factory_reset_button.cpp +18 -1
- esphome/components/factory_reset/button/factory_reset_button.h +6 -1
- esphome/components/factory_reset/switch/factory_reset_switch.cpp +18 -1
- esphome/components/factory_reset/switch/factory_reset_switch.h +5 -1
- esphome/components/ina2xx_base/__init__.py +4 -2
- esphome/components/md5/md5.cpp +3 -2
- esphome/components/mqtt/mqtt_client.cpp +1 -1
- esphome/components/openthread/openthread.cpp +41 -7
- esphome/components/openthread/openthread.h +11 -0
- esphome/components/select/select.cpp +3 -3
- esphome/components/select/select_call.cpp +1 -1
- esphome/components/web_server/server_index_v2.h +149 -149
- esphome/components/wifi/wifi_component.cpp +1 -1
- esphome/components/wifi_info/wifi_info_text_sensor.h +3 -2
- esphome/const.py +2 -1
- esphome/core/defines.h +1 -0
- esphome/core/helpers.cpp +8 -7
- esphome/core/helpers.h +29 -0
- esphome/core/scheduler.cpp +4 -4
- esphome/core/scheduler.h +1 -1
- esphome/dashboard/web_server.py +2 -5
- {esphome-2025.9.0b1.dist-info → esphome-2025.9.0b3.dist-info}/METADATA +2 -2
- {esphome-2025.9.0b1.dist-info → esphome-2025.9.0b3.dist-info}/RECORD +48 -48
- {esphome-2025.9.0b1.dist-info → esphome-2025.9.0b3.dist-info}/WHEEL +0 -0
- {esphome-2025.9.0b1.dist-info → esphome-2025.9.0b3.dist-info}/entry_points.txt +0 -0
- {esphome-2025.9.0b1.dist-info → esphome-2025.9.0b3.dist-info}/licenses/LICENSE +0 -0
- {esphome-2025.9.0b1.dist-info → esphome-2025.9.0b3.dist-info}/top_level.txt +0 -0
@@ -7,103 +7,83 @@ namespace esphome {
|
|
7
7
|
namespace captive_portal {
|
8
8
|
|
9
9
|
const uint8_t INDEX_GZ[] PROGMEM = {
|
10
|
-
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
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0x8a, 0x3a, 0x41, 0x19, 0x34, 0x4a, 0x54, 0xa0, 0xc9,
|
80
|
+
0xdd, 0xdd, 0xaf, 0x7f, 0x2f, 0x9d, 0x33, 0x8f, 0x72, 0x9d, 0x59, 0x8f, 0x62, 0x0e, 0x98, 0xa4, 0x16, 0x37, 0xe3,
|
81
|
+
0xa5, 0xaa, 0xa3, 0xc6, 0x6c, 0x95, 0xae, 0xbe, 0xd2, 0xf1, 0x7e, 0x42, 0x8e, 0x7a, 0x86, 0xff, 0xd0, 0x2a, 0xe5,
|
82
|
+
0x1d, 0xdd, 0x40, 0x11, 0x4d, 0x87, 0x22, 0x72, 0x0e, 0x8f, 0xf4, 0x66, 0xe2, 0x6b, 0x92, 0xf2, 0x8f, 0xfb, 0x37,
|
83
|
+
0xe8, 0xcf, 0xae, 0xa2, 0x16, 0xc6, 0xb4, 0x0d, 0x51, 0xb5, 0x60, 0x1b, 0x55, 0x91, 0xf7, 0x7f, 0xdc, 0xdd, 0x9f,
|
84
|
+
0x23, 0xec, 0x07, 0x26, 0x04, 0x92, 0x8d, 0xd7, 0xbb, 0x5e, 0x58, 0xde, 0x51, 0x6d, 0x07, 0xb5, 0x81, 0x9b, 0x22,
|
85
|
+
0xa7, 0x18, 0x06, 0x7a, 0xcd, 0x05, 0x8c, 0x61, 0x8c, 0x82, 0x25, 0x3a, 0x79, 0x75, 0xb2, 0xf6, 0xc4, 0xaf, 0x68,
|
86
|
+
0xfc, 0xda, 0xd1, 0xf8, 0xe9, 0xa3, 0xe1, 0xa6, 0xfb, 0x1f, 0x53, 0x58, 0x46, 0xb2, 0xf9, 0x0a, 0x00, 0x00};
|
107
87
|
|
108
88
|
} // namespace captive_portal
|
109
89
|
} // namespace esphome
|
@@ -7,6 +7,7 @@
|
|
7
7
|
#include <cstdio>
|
8
8
|
#include <cinttypes>
|
9
9
|
#include "esphome/core/log.h"
|
10
|
+
#include "esphome/core/helpers.h"
|
10
11
|
|
11
12
|
namespace esphome::esp32_ble {
|
12
13
|
|
@@ -169,22 +170,42 @@ bool ESPBTUUID::operator==(const ESPBTUUID &uuid) const {
|
|
169
170
|
}
|
170
171
|
esp_bt_uuid_t ESPBTUUID::get_uuid() const { return this->uuid_; }
|
171
172
|
std::string ESPBTUUID::to_string() const {
|
173
|
+
char buf[40]; // Enough for 128-bit UUID with dashes
|
174
|
+
char *pos = buf;
|
175
|
+
|
172
176
|
switch (this->uuid_.len) {
|
173
177
|
case ESP_UUID_LEN_16:
|
174
|
-
|
178
|
+
*pos++ = '0';
|
179
|
+
*pos++ = 'x';
|
180
|
+
*pos++ = format_hex_pretty_char(this->uuid_.uuid.uuid16 >> 12);
|
181
|
+
*pos++ = format_hex_pretty_char((this->uuid_.uuid.uuid16 >> 8) & 0x0F);
|
182
|
+
*pos++ = format_hex_pretty_char((this->uuid_.uuid.uuid16 >> 4) & 0x0F);
|
183
|
+
*pos++ = format_hex_pretty_char(this->uuid_.uuid.uuid16 & 0x0F);
|
184
|
+
*pos = '\0';
|
185
|
+
return std::string(buf);
|
186
|
+
|
175
187
|
case ESP_UUID_LEN_32:
|
176
|
-
|
177
|
-
|
178
|
-
|
188
|
+
*pos++ = '0';
|
189
|
+
*pos++ = 'x';
|
190
|
+
for (int shift = 28; shift >= 0; shift -= 4) {
|
191
|
+
*pos++ = format_hex_pretty_char((this->uuid_.uuid.uuid32 >> shift) & 0x0F);
|
192
|
+
}
|
193
|
+
*pos = '\0';
|
194
|
+
return std::string(buf);
|
195
|
+
|
179
196
|
default:
|
180
197
|
case ESP_UUID_LEN_128:
|
181
|
-
|
198
|
+
// Format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
182
199
|
for (int8_t i = 15; i >= 0; i--) {
|
183
|
-
|
184
|
-
|
185
|
-
|
200
|
+
uint8_t byte = this->uuid_.uuid.uuid128[i];
|
201
|
+
*pos++ = format_hex_pretty_char(byte >> 4);
|
202
|
+
*pos++ = format_hex_pretty_char(byte & 0x0F);
|
203
|
+
if (i == 12 || i == 10 || i == 8 || i == 6) {
|
204
|
+
*pos++ = '-';
|
205
|
+
}
|
186
206
|
}
|
187
|
-
|
207
|
+
*pos = '\0';
|
208
|
+
return std::string(buf);
|
188
209
|
}
|
189
210
|
return "";
|
190
211
|
}
|
@@ -31,12 +31,13 @@ void ESP32BLEBeacon::dump_config() {
|
|
31
31
|
char uuid[37];
|
32
32
|
char *bpos = uuid;
|
33
33
|
for (int8_t ii = 0; ii < 16; ++ii) {
|
34
|
-
bpos
|
34
|
+
*bpos++ = format_hex_pretty_char(this->uuid_[ii] >> 4);
|
35
|
+
*bpos++ = format_hex_pretty_char(this->uuid_[ii] & 0x0F);
|
35
36
|
if (ii == 3 || ii == 5 || ii == 7 || ii == 9) {
|
36
|
-
bpos
|
37
|
+
*bpos++ = '-';
|
37
38
|
}
|
38
39
|
}
|
39
|
-
|
40
|
+
*bpos = '\0';
|
40
41
|
ESP_LOGCONFIG(TAG,
|
41
42
|
" UUID: %s, Major: %u, Minor: %u, Min Interval: %ums, Max Interval: %ums, Measured Power: %d"
|
42
43
|
", TX Power: %ddBm",
|
@@ -60,11 +60,14 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
|
|
60
60
|
if (address == 0) {
|
61
61
|
this->address_str_ = "";
|
62
62
|
} else {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
char buf[18];
|
64
|
+
uint8_t mac[6] = {
|
65
|
+
(uint8_t) ((this->address_ >> 40) & 0xff), (uint8_t) ((this->address_ >> 32) & 0xff),
|
66
|
+
(uint8_t) ((this->address_ >> 24) & 0xff), (uint8_t) ((this->address_ >> 16) & 0xff),
|
67
|
+
(uint8_t) ((this->address_ >> 8) & 0xff), (uint8_t) ((this->address_ >> 0) & 0xff),
|
68
|
+
};
|
69
|
+
format_mac_addr_upper(mac, buf);
|
70
|
+
this->address_str_ = buf;
|
68
71
|
}
|
69
72
|
}
|
70
73
|
const std::string &address_str() const { return this->address_str_; }
|
@@ -607,9 +607,8 @@ void ESPBTDevice::parse_adv_(const uint8_t *payload, uint8_t len) {
|
|
607
607
|
}
|
608
608
|
|
609
609
|
std::string ESPBTDevice::address_str() const {
|
610
|
-
char mac[
|
611
|
-
|
612
|
-
this->address_[3], this->address_[4], this->address_[5]);
|
610
|
+
char mac[18];
|
611
|
+
format_mac_addr_upper(this->address_, mac);
|
613
612
|
return mac;
|
614
613
|
}
|
615
614
|
|
@@ -77,6 +77,13 @@ ETHERNET_TYPES = {
|
|
77
77
|
"DM9051": EthernetType.ETHERNET_TYPE_DM9051,
|
78
78
|
}
|
79
79
|
|
80
|
+
# PHY types that need compile-time defines for conditional compilation
|
81
|
+
_PHY_TYPE_TO_DEFINE = {
|
82
|
+
"KSZ8081": "USE_ETHERNET_KSZ8081",
|
83
|
+
"KSZ8081RNA": "USE_ETHERNET_KSZ8081",
|
84
|
+
# Add other PHY types here only if they need conditional compilation
|
85
|
+
}
|
86
|
+
|
80
87
|
SPI_ETHERNET_TYPES = ["W5500", "DM9051"]
|
81
88
|
SPI_ETHERNET_DEFAULT_POLLING_INTERVAL = TimePeriodMilliseconds(milliseconds=10)
|
82
89
|
|
@@ -345,6 +352,10 @@ async def to_code(config):
|
|
345
352
|
if CONF_MANUAL_IP in config:
|
346
353
|
cg.add(var.set_manual_ip(manual_ip(config[CONF_MANUAL_IP])))
|
347
354
|
|
355
|
+
# Add compile-time define for PHY types with specific code
|
356
|
+
if phy_define := _PHY_TYPE_TO_DEFINE.get(config[CONF_TYPE]):
|
357
|
+
cg.add_define(phy_define)
|
358
|
+
|
348
359
|
cg.add_define("USE_ETHERNET")
|
349
360
|
|
350
361
|
# Disable WiFi when using Ethernet to save memory
|
@@ -229,10 +229,12 @@ void EthernetComponent::setup() {
|
|
229
229
|
ESPHL_ERROR_CHECK(err, "ETH driver install error");
|
230
230
|
|
231
231
|
#ifndef USE_ETHERNET_SPI
|
232
|
+
#ifdef USE_ETHERNET_KSZ8081
|
232
233
|
if (this->type_ == ETHERNET_TYPE_KSZ8081RNA && this->clk_mode_ == EMAC_CLK_OUT) {
|
233
234
|
// KSZ8081RNA default is incorrect. It expects a 25MHz clock instead of the 50MHz we provide.
|
234
235
|
this->ksz8081_set_clock_reference_(mac);
|
235
236
|
}
|
237
|
+
#endif // USE_ETHERNET_KSZ8081
|
236
238
|
|
237
239
|
for (const auto &phy_register : this->phy_registers_) {
|
238
240
|
this->write_phy_register_(mac, phy_register);
|
@@ -300,6 +302,7 @@ void EthernetComponent::loop() {
|
|
300
302
|
this->state_ = EthernetComponentState::CONNECTING;
|
301
303
|
this->start_connect_();
|
302
304
|
} else {
|
305
|
+
this->finish_connect_();
|
303
306
|
// When connected and stable, disable the loop to save CPU cycles
|
304
307
|
this->disable_loop();
|
305
308
|
}
|
@@ -486,10 +489,35 @@ void EthernetComponent::got_ip6_event_handler(void *arg, esp_event_base_t event_
|
|
486
489
|
}
|
487
490
|
#endif /* USE_NETWORK_IPV6 */
|
488
491
|
|
492
|
+
void EthernetComponent::finish_connect_() {
|
493
|
+
#if USE_NETWORK_IPV6
|
494
|
+
// Retry IPv6 link-local setup if it failed during initial connect
|
495
|
+
// This handles the case where min_ipv6_addr_count is NOT set (or is 0),
|
496
|
+
// allowing us to reach CONNECTED state with just IPv4.
|
497
|
+
// If IPv6 setup failed in start_connect_() because the interface wasn't ready:
|
498
|
+
// - Bootup timing issues (#10281)
|
499
|
+
// - Cable unplugged/network interruption (#10705)
|
500
|
+
// We can now retry since we're in CONNECTED state and the interface is definitely up.
|
501
|
+
if (!this->ipv6_setup_done_) {
|
502
|
+
esp_err_t err = esp_netif_create_ip6_linklocal(this->eth_netif_);
|
503
|
+
if (err == ESP_OK) {
|
504
|
+
ESP_LOGD(TAG, "IPv6 link-local address created (retry succeeded)");
|
505
|
+
}
|
506
|
+
// Always set the flag to prevent continuous retries
|
507
|
+
// If IPv6 setup fails here with the interface up and stable, it's
|
508
|
+
// likely a persistent issue (IPv6 disabled at router, hardware
|
509
|
+
// limitation, etc.) that won't be resolved by further retries.
|
510
|
+
// The device continues to work with IPv4.
|
511
|
+
this->ipv6_setup_done_ = true;
|
512
|
+
}
|
513
|
+
#endif /* USE_NETWORK_IPV6 */
|
514
|
+
}
|
515
|
+
|
489
516
|
void EthernetComponent::start_connect_() {
|
490
517
|
global_eth_component->got_ipv4_address_ = false;
|
491
518
|
#if USE_NETWORK_IPV6
|
492
519
|
global_eth_component->ipv6_count_ = 0;
|
520
|
+
this->ipv6_setup_done_ = false;
|
493
521
|
#endif /* USE_NETWORK_IPV6 */
|
494
522
|
this->connect_begin_ = millis();
|
495
523
|
this->status_set_warning(LOG_STR("waiting for IP configuration"));
|
@@ -545,9 +573,27 @@ void EthernetComponent::start_connect_() {
|
|
545
573
|
}
|
546
574
|
}
|
547
575
|
#if USE_NETWORK_IPV6
|
576
|
+
// Attempt to create IPv6 link-local address
|
577
|
+
// We MUST attempt this here, not just in finish_connect_(), because with
|
578
|
+
// min_ipv6_addr_count set, the component won't reach CONNECTED state without IPv6.
|
579
|
+
// However, this may fail with ESP_FAIL if the interface is not up yet:
|
580
|
+
// - At bootup when link isn't ready (#10281)
|
581
|
+
// - After disconnection/cable unplugged (#10705)
|
582
|
+
// We'll retry in finish_connect_() if it fails here.
|
548
583
|
err = esp_netif_create_ip6_linklocal(this->eth_netif_);
|
549
584
|
if (err != ESP_OK) {
|
550
|
-
|
585
|
+
if (err == ESP_ERR_ESP_NETIF_INVALID_PARAMS) {
|
586
|
+
// This is a programming error, not a transient failure
|
587
|
+
ESPHL_ERROR_CHECK(err, "esp_netif_create_ip6_linklocal invalid parameters");
|
588
|
+
} else {
|
589
|
+
// ESP_FAIL means the interface isn't up yet
|
590
|
+
// This is expected and non-fatal, happens in multiple scenarios:
|
591
|
+
// - During reconnection after network interruptions (#10705)
|
592
|
+
// - At bootup when the link isn't ready yet (#10281)
|
593
|
+
// We'll retry once we reach CONNECTED state and the interface is up
|
594
|
+
ESP_LOGW(TAG, "esp_netif_create_ip6_linklocal failed: %s", esp_err_to_name(err));
|
595
|
+
// Don't mark component as failed - this is a transient error
|
596
|
+
}
|
551
597
|
}
|
552
598
|
#endif /* USE_NETWORK_IPV6 */
|
553
599
|
|
@@ -638,7 +684,9 @@ void EthernetComponent::get_eth_mac_address_raw(uint8_t *mac) {
|
|
638
684
|
std::string EthernetComponent::get_eth_mac_address_pretty() {
|
639
685
|
uint8_t mac[6];
|
640
686
|
get_eth_mac_address_raw(mac);
|
641
|
-
|
687
|
+
char buf[18];
|
688
|
+
format_mac_addr_upper(mac, buf);
|
689
|
+
return std::string(buf);
|
642
690
|
}
|
643
691
|
|
644
692
|
eth_duplex_t EthernetComponent::get_duplex_mode() {
|
@@ -675,6 +723,7 @@ bool EthernetComponent::powerdown() {
|
|
675
723
|
|
676
724
|
#ifndef USE_ETHERNET_SPI
|
677
725
|
|
726
|
+
#ifdef USE_ETHERNET_KSZ8081
|
678
727
|
constexpr uint8_t KSZ80XX_PC2R_REG_ADDR = 0x1F;
|
679
728
|
|
680
729
|
void EthernetComponent::ksz8081_set_clock_reference_(esp_eth_mac_t *mac) {
|
@@ -703,6 +752,7 @@ void EthernetComponent::ksz8081_set_clock_reference_(esp_eth_mac_t *mac) {
|
|
703
752
|
ESP_LOGVV(TAG, "KSZ8081 PHY Control 2: %s", format_hex_pretty((u_int8_t *) &phy_control_2, 2).c_str());
|
704
753
|
}
|
705
754
|
}
|
755
|
+
#endif // USE_ETHERNET_KSZ8081
|
706
756
|
|
707
757
|
void EthernetComponent::write_phy_register_(esp_eth_mac_t *mac, PHYRegister register_data) {
|
708
758
|
esp_err_t err;
|
@@ -102,9 +102,12 @@ class EthernetComponent : public Component {
|
|
102
102
|
#endif /* LWIP_IPV6 */
|
103
103
|
|
104
104
|
void start_connect_();
|
105
|
+
void finish_connect_();
|
105
106
|
void dump_connect_params_();
|
107
|
+
#ifdef USE_ETHERNET_KSZ8081
|
106
108
|
/// @brief Set `RMII Reference Clock Select` bit for KSZ8081.
|
107
109
|
void ksz8081_set_clock_reference_(esp_eth_mac_t *mac);
|
110
|
+
#endif
|
108
111
|
/// @brief Set arbitratry PHY registers from config.
|
109
112
|
void write_phy_register_(esp_eth_mac_t *mac, PHYRegister register_data);
|
110
113
|
|
@@ -144,6 +147,7 @@ class EthernetComponent : public Component {
|
|
144
147
|
bool got_ipv4_address_{false};
|
145
148
|
#if LWIP_IPV6
|
146
149
|
uint8_t ipv6_count_{0};
|
150
|
+
bool ipv6_setup_done_{false};
|
147
151
|
#endif /* LWIP_IPV6 */
|
148
152
|
|
149
153
|
// Pointers at the end (naturally aligned)
|
@@ -1,7 +1,13 @@
|
|
1
1
|
#include "factory_reset_button.h"
|
2
|
+
|
3
|
+
#include "esphome/core/defines.h"
|
4
|
+
|
5
|
+
#ifdef USE_OPENTHREAD
|
6
|
+
#include "esphome/components/openthread/openthread.h"
|
7
|
+
#endif
|
8
|
+
#include "esphome/core/application.h"
|
2
9
|
#include "esphome/core/hal.h"
|
3
10
|
#include "esphome/core/log.h"
|
4
|
-
#include "esphome/core/application.h"
|
5
11
|
|
6
12
|
namespace esphome {
|
7
13
|
namespace factory_reset {
|
@@ -13,9 +19,20 @@ void FactoryResetButton::press_action() {
|
|
13
19
|
ESP_LOGI(TAG, "Resetting");
|
14
20
|
// Let MQTT settle a bit
|
15
21
|
delay(100); // NOLINT
|
22
|
+
#ifdef USE_OPENTHREAD
|
23
|
+
openthread::global_openthread_component->on_factory_reset(FactoryResetButton::factory_reset_callback);
|
24
|
+
#else
|
25
|
+
global_preferences->reset();
|
26
|
+
App.safe_reboot();
|
27
|
+
#endif
|
28
|
+
}
|
29
|
+
|
30
|
+
#ifdef USE_OPENTHREAD
|
31
|
+
void FactoryResetButton::factory_reset_callback() {
|
16
32
|
global_preferences->reset();
|
17
33
|
App.safe_reboot();
|
18
34
|
}
|
35
|
+
#endif
|
19
36
|
|
20
37
|
} // namespace factory_reset
|
21
38
|
} // namespace esphome
|
@@ -1,7 +1,9 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
-
#include "esphome/core/
|
3
|
+
#include "esphome/core/defines.h"
|
4
|
+
|
4
5
|
#include "esphome/components/button/button.h"
|
6
|
+
#include "esphome/core/component.h"
|
5
7
|
|
6
8
|
namespace esphome {
|
7
9
|
namespace factory_reset {
|
@@ -9,6 +11,9 @@ namespace factory_reset {
|
|
9
11
|
class FactoryResetButton : public button::Button, public Component {
|
10
12
|
public:
|
11
13
|
void dump_config() override;
|
14
|
+
#ifdef USE_OPENTHREAD
|
15
|
+
static void factory_reset_callback();
|
16
|
+
#endif
|
12
17
|
|
13
18
|
protected:
|
14
19
|
void press_action() override;
|
@@ -1,7 +1,13 @@
|
|
1
1
|
#include "factory_reset_switch.h"
|
2
|
+
|
3
|
+
#include "esphome/core/defines.h"
|
4
|
+
|
5
|
+
#ifdef USE_OPENTHREAD
|
6
|
+
#include "esphome/components/openthread/openthread.h"
|
7
|
+
#endif
|
8
|
+
#include "esphome/core/application.h"
|
2
9
|
#include "esphome/core/hal.h"
|
3
10
|
#include "esphome/core/log.h"
|
4
|
-
#include "esphome/core/application.h"
|
5
11
|
|
6
12
|
namespace esphome {
|
7
13
|
namespace factory_reset {
|
@@ -17,10 +23,21 @@ void FactoryResetSwitch::write_state(bool state) {
|
|
17
23
|
ESP_LOGI(TAG, "Resetting");
|
18
24
|
// Let MQTT settle a bit
|
19
25
|
delay(100); // NOLINT
|
26
|
+
#ifdef USE_OPENTHREAD
|
27
|
+
openthread::global_openthread_component->on_factory_reset(FactoryResetSwitch::factory_reset_callback);
|
28
|
+
#else
|
20
29
|
global_preferences->reset();
|
21
30
|
App.safe_reboot();
|
31
|
+
#endif
|
22
32
|
}
|
23
33
|
}
|
24
34
|
|
35
|
+
#ifdef USE_OPENTHREAD
|
36
|
+
void FactoryResetSwitch::factory_reset_callback() {
|
37
|
+
global_preferences->reset();
|
38
|
+
App.safe_reboot();
|
39
|
+
}
|
40
|
+
#endif
|
41
|
+
|
25
42
|
} // namespace factory_reset
|
26
43
|
} // namespace esphome
|