From 4116caff6ae1262502dd7c4d6952a140105146f8 Mon Sep 17 00:00:00 2001 From: Ruben De Smet Date: Wed, 11 May 2022 01:44:52 +0200 Subject: [PATCH] Implement allow_deep_sleep (#3282) --- esphome/components/deep_sleep/deep_sleep_component.cpp | 1 + esphome/components/deep_sleep/deep_sleep_component.h | 1 + 2 files changed, 2 insertions(+) diff --git a/esphome/components/deep_sleep/deep_sleep_component.cpp b/esphome/components/deep_sleep/deep_sleep_component.cpp index 1e31cef33e..8db100f236 100644 --- a/esphome/components/deep_sleep/deep_sleep_component.cpp +++ b/esphome/components/deep_sleep/deep_sleep_component.cpp @@ -160,6 +160,7 @@ void DeepSleepComponent::begin_sleep(bool manual) { } float DeepSleepComponent::get_setup_priority() const { return setup_priority::LATE; } void DeepSleepComponent::prevent_deep_sleep() { this->prevent_ = true; } +void DeepSleepComponent::allow_deep_sleep() { this->prevent_ = false; } } // namespace deep_sleep } // namespace esphome diff --git a/esphome/components/deep_sleep/deep_sleep_component.h b/esphome/components/deep_sleep/deep_sleep_component.h index 1ff681693f..f384dee01d 100644 --- a/esphome/components/deep_sleep/deep_sleep_component.h +++ b/esphome/components/deep_sleep/deep_sleep_component.h @@ -96,6 +96,7 @@ class DeepSleepComponent : public Component { void begin_sleep(bool manual = false); void prevent_deep_sleep(); + void allow_deep_sleep(); protected: // Returns nullopt if no run duration is set. Otherwise, returns the run