ESPHome 2026.10.0-dev
Loading...
Searching...
No Matches
safe_mode_switch.cpp
Go to the documentation of this file.
1#include "safe_mode_switch.h"
3#include "esphome/core/hal.h"
4#include "esphome/core/log.h"
5
6namespace esphome::safe_mode {
7
8static const char *const TAG = "safe_mode.switch";
9
11 // Acknowledge
12 this->publish_state(false);
13
14 if (state) {
15 ESP_LOGI(TAG, "Restarting in safe mode");
17
18 // Let MQTT settle a bit
19 delay(100); // NOLINT
21 }
22}
23
24void SafeModeSwitch::dump_config() { LOG_SWITCH("", "Safe Mode Switch", this); }
25
26} // namespace esphome::safe_mode
void set_safe_mode_pending(const bool &pending)
Set to true if the next startup will enter safe mode.
void write_state(bool state) override
void publish_state(bool state)
Publish a state to the front-end from the back-end.
Definition switch.cpp:57
bool state
Definition fan.h:2
void HOT delay(uint32_t ms)
Definition hal.cpp:85
Application App
Global storage of Application pointer - only one Application can exist.