ESPHome 2026.8.0-dev
Loading...
Searching...
No Matches
esphome::deep_sleep Namespace Reference

Data Structures

class  AllowDeepSleepAction
 
class  DeepSleepComponent
 This component allows setting up the node to go into deep sleep mode to conserve battery. More...
 
class  EnterDeepSleepAction
 
class  Ext1WakeTrigger
 Fires once on boot when the device was woken from deep sleep by the given ext1 pin. More...
 
struct  Ext1Wakeup
 
class  PreventDeepSleepAction
 
class  WakeTrigger
 Fires once on boot when the device woke from deep sleep, with the wakeup cause. More...
 
struct  WakeupCauseToRunDuration
 
struct  WakeUpPinItem
 

Enumerations

enum  WakeupPinMode { WAKEUP_PIN_MODE_IGNORE = 0 , WAKEUP_PIN_MODE_KEEP_AWAKE , WAKEUP_PIN_MODE_INVERT_WAKEUP }
 The values of this enum define what should be done if deep sleep is set up with a wakeup pin on the ESP32 and the scenario occurs that the wakeup pin is already in the wakeup state. More...
 
enum  WakeupCause : uint8_t {
  WAKEUP_CAUSE_NONE = 0 , WAKEUP_CAUSE_UNKNOWN , WAKEUP_CAUSE_TIMER , WAKEUP_CAUSE_GPIO ,
  WAKEUP_CAUSE_TOUCH
}
 Why the device woke from deep sleep. Passed to on_wake automations. More...
 

Functions

WakeupCause get_wakeup_cause ()
 Return why the device woke from deep sleep. Implemented per platform.
 

Variables

bool global_has_deep_sleep = false
 
constexpr float ON_WAKE_TRIGGER_SETUP_PRIORITY = 700.0f
 Setup priority of on_wake triggers.
 

Enumeration Type Documentation

◆ WakeupCause

Why the device woke from deep sleep. Passed to on_wake automations.

Enumerator
WAKEUP_CAUSE_NONE 

The device did not wake from deep sleep (for example a cold boot, reset or OTA restart).

WAKEUP_CAUSE_UNKNOWN 

The device woke from deep sleep, but the source could not be identified.

WAKEUP_CAUSE_TIMER 

The device was woken by the sleep timer.

WAKEUP_CAUSE_GPIO 

The device was woken by a GPIO pin (wakeup_pin or esp32_ext1_wakeup).

WAKEUP_CAUSE_TOUCH 

The device was woken by a touch pad.

Definition at line 66 of file deep_sleep_component.h.

◆ WakeupPinMode

The values of this enum define what should be done if deep sleep is set up with a wakeup pin on the ESP32 and the scenario occurs that the wakeup pin is already in the wakeup state.

Enumerator
WAKEUP_PIN_MODE_IGNORE 

Ignore the fact that we will wake up when going into deep sleep.

WAKEUP_PIN_MODE_KEEP_AWAKE 

As long as the wakeup pin is still in the wakeup state, keep awake.

WAKEUP_PIN_MODE_INVERT_WAKEUP 

Automatically invert the wakeup level.

For example if we were set up to wake up on HIGH, but the pin is already high when attempting to enter deep sleep, re-configure deep sleep to wake up on LOW level.

Definition at line 25 of file deep_sleep_component.h.

Function Documentation

◆ get_wakeup_cause()

WakeupCause esphome::deep_sleep::get_wakeup_cause ( )

Return why the device woke from deep sleep. Implemented per platform.

Definition at line 11 of file deep_sleep_bk72xx.cpp.

Variable Documentation

◆ global_has_deep_sleep

bool esphome::deep_sleep::global_has_deep_sleep = false

Definition at line 11 of file deep_sleep_component.cpp.

◆ ON_WAKE_TRIGGER_SETUP_PRIORITY

float esphome::deep_sleep::ON_WAKE_TRIGGER_SETUP_PRIORITY = 700.0f
inlineconstexpr

Setup priority of on_wake triggers.

Between restoring global variables (setup_priority::HARDWARE, 800) and on_boot automations at their default priority (600), so on_wake automations can update state (e.g. globals) that on_boot automations then use.

Definition at line 88 of file deep_sleep_component.h.