ESPHome 2025.10.0-dev
Loading...
Searching...
No Matches
factory_reset_switch.cpp
Go to the documentation of this file.
2
4
5#ifdef USE_OPENTHREAD
7#endif
9#include "esphome/core/hal.h"
10#include "esphome/core/log.h"
11
12namespace esphome {
13namespace factory_reset {
14
15static const char *const TAG = "factory_reset.switch";
16
17void FactoryResetSwitch::dump_config() { LOG_SWITCH("", "Factory Reset Switch", this); }
19 // Acknowledge
20 this->publish_state(false);
21
22 if (state) {
23 ESP_LOGI(TAG, "Resetting");
24 // Let MQTT settle a bit
25 delay(100); // NOLINT
26#ifdef USE_OPENTHREAD
28#else
31#endif
32 }
33}
34
35#ifdef USE_OPENTHREAD
40#endif
41
42} // namespace factory_reset
43} // namespace esphome
virtual bool reset()=0
Forget all unsaved changes and re-initialize the permanent preferences storage.
void on_factory_reset(std::function< void()> callback)
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition switch.cpp:55
bool state
Definition fan.h:0
OpenThreadComponent * global_openthread_component
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
ESPPreferences * global_preferences
void IRAM_ATTR HOT delay(uint32_t ms)
Definition core.cpp:29
Application App
Global storage of Application pointer - only one Application can exist.