ESPHome 2025.5.0
Loading...
Searching...
No Matches
factory_reset_switch.cpp
Go to the documentation of this file.
2#include "esphome/core/hal.h"
3#include "esphome/core/log.h"
5
6namespace esphome {
7namespace factory_reset {
8
9static const char *const TAG = "factory_reset.switch";
10
11void FactoryResetSwitch::dump_config() { LOG_SWITCH("", "Factory Reset Switch", this); }
13 // Acknowledge
14 this->publish_state(false);
15
16 if (state) {
17 ESP_LOGI(TAG, "Resetting to factory defaults...");
18 // Let MQTT settle a bit
19 delay(100); // NOLINT
22 }
23}
24
25} // namespace factory_reset
26} // namespace esphome
virtual bool reset()=0
Forget all unsaved changes and re-initialize the permanent preferences storage.
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition switch.cpp:47
bool state
Definition fan.h:0
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:28
Application App
Global storage of Application pointer - only one Application can exist.