Skip to content

Conversation

@brentru
Copy link
Member

@brentru brentru commented Dec 18, 2025

This pull request adds support for ESP32x sleep functionality to the WipperSnapper API, enabling the option of having low-power WipperSnapper nodes.

Sleep "Mode" Overview
Device Boot and Sleep Cycle-2025-12-19-192226

  • message Enter contains configuration for a node to configure itself for entering a sleep mode.

    • mode - Required sleep mode, supports the primary ESP32x sleep modes - Light Sleep and Deep Sleep
      • Note: While this may eventually be automatically selected and filled by the broker depending on the WakeupSource and TimerConfig's duration. However, I think we'll always want to expose this field (even if we hide it or put it under an "advanced options" dropdown).
    • WakeupSource - There are several wakeup sources in the sleep modes. However, we are only supporting timer-based wake (RTC/timer) and pin-based wake (external GPIO)
    • config contains mode configuration
  • message Goodnight contains a message to indicate the device is going to sleep. It is published to Adafruit IO. It may eventually be required to expanded to contain a failure state (if the device fails to go into deep sleep).

  • message Wake - Sent when a device wakes up from sleep.

    • Contains a wake reason (EspWakeCause)
      • We are expecting to expand this to multiple chipsets if they have compatibility, so WakeCause is a oneof.
    • Contains a calculated sleep duration (may be used to determine drift, or debug if the device actually went to sleep)

@brentru brentru marked this pull request as draft December 18, 2025 20:40
@brentru brentru requested review from lorennorman and tyeth December 19, 2025 19:23
@brentru brentru marked this pull request as ready for review December 19, 2025 19:23
enum WakeupSource {
W_UNSPECIFIED = 0; /** Wakeup source is unspecified. */
W_TIMER = 1; /** Wakeup source is a timer. */
W_PIN = 2; /** Wakeup source is a pin. */
Copy link
Member

@tyeth tyeth Dec 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if we have 3=w_pins, 4=timer+pin, 5=timer+pins. Maybe pin could just use the pins mask version instead so we only need an extra one for 3=timer+pin

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a MVP. We can always extend this enum in the future to support EXT1 (multiple pin) wakeup source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants