ESPHome 2026.6.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::factory_reset {
13
14static const char *const TAG = "factory_reset.switch";
15
16void FactoryResetSwitch::dump_config() { LOG_SWITCH("", "Factory Reset Switch", this); }
18 // Acknowledge
19 this->publish_state(false);
20
21 if (state) {
22 ESP_LOGI(TAG, "Resetting");
23 // Let MQTT settle a bit
24 delay(100); // NOLINT
25#ifdef USE_OPENTHREAD
27#else
30#endif
31 }
32}
33
34#ifdef USE_OPENTHREAD
39#endif
40
41} // namespace esphome::factory_reset
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:56
bool state
Definition fan.h:2
OpenThreadComponent * global_openthread_component
ESPPreferences * global_preferences
void HOT delay(uint32_t ms)
Definition hal.cpp:85
Application App
Global storage of Application pointer - only one Application can exist.
bool reset()
Forget all unsaved changes and re-initialize the permanent preferences storage.
Definition preferences.h:40