ESPHome 2025.5.0
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
13namespace esphome {
14namespace shutdown {
15
16static const char *const TAG = "shutdown.button";
17
18void ShutdownButton::dump_config() { LOG_BUTTON("", "Shutdown Button", this); }
20 ESP_LOGI(TAG, "Shutting down...");
21 // Let MQTT settle a bit
22 delay(100); // NOLINT
24#ifdef USE_ESP8266
25 ESP.deepSleep(0); // NOLINT(readability-static-accessed-through-instance)
26#endif
27#ifdef USE_ESP32
28 esp_deep_sleep_start();
29#endif
30}
31
32} // namespace shutdown
33} // namespace esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
void IRAM_ATTR HOT delay(uint32_t ms)
Definition core.cpp:28
Application App
Global storage of Application pointer - only one Application can exist.