ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
shutdown_button.cpp
Go to the documentation of this file.
1#include "shutdown_button.h"
2#include "esphome/core/hal.h"
3#include "esphome/core/log.h"
5
6#ifdef USE_ESP32
7#include <esp_sleep.h>
8#endif
9#ifdef USE_ESP8266
10#include <Esp.h>
11#endif
12
14
15ESPHOME_LOG_TAG(TAG, "shutdown.button");
16
18 ESP_LOGI(TAG, "Shutting down");
19 // Let MQTT settle a bit
20 delay(100); // NOLINT
22#ifdef USE_ESP8266
23 ESP.deepSleep(0); // NOLINT(readability-static-accessed-through-instance)
24#endif
25#ifdef USE_ESP32
26 esp_deep_sleep_start();
27#endif
28}
29
30} // namespace esphome::shutdown
void shutdown_device()
Run by the shutdown button.
ESPHOME_LOG_TAG(TAG, "shutdown.button")
void HOT delay(uint32_t ms)
Definition hal.cpp:85
Application App
Global storage of Application pointer - only one Application can exist.