37#if defined(USE_ESP32) && !defined(USE_ESP32_VARIANT_ESP32C3)
79#if !defined(USE_ESP32_VARIANT_ESP32C3)
94 void setup()
override;
120#if !defined(USE_ESP32_VARIANT_ESP32C3)
150 if (this->sleep_duration_.has_value()) {
157 const uint32_t timestamp_now = time.
timestamp;
159 bool after_time =
false;
160 if (time.hour > this->hour_) {
163 if (time.hour == this->hour_) {
164 if (time.minute > this->minute_) {
167 if (time.minute == this->minute_) {
168 if (time.second > this->second_) {
176 time.hour = *this->
hour_;
179 time.recalc_timestamp_utc();
188 const uint32_t ms_left = (
timestamp - timestamp_now) * 1000;
Helper class to easily give an object a parent of type T.
DeepSleepComponent * parent_
void play(Ts... x) override
This component allows setting up the node to go into deep sleep mode to conserve battery.
WakeupPinMode wakeup_pin_mode_
void set_run_duration(WakeupCauseToRunDuration wakeup_cause_to_run_duration)
void set_touch_wakeup(bool touch_wakeup)
void dump_config() override
InternalGPIOPin * wakeup_pin_
optional< Ext1Wakeup > ext1_wakeup_
optional< bool > touch_wakeup_
optional< uint64_t > sleep_duration_
optional< uint32_t > get_run_duration_() const
void prevent_deep_sleep()
void set_wakeup_pin_mode(WakeupPinMode wakeup_pin_mode)
bool next_enter_deep_sleep_
void begin_sleep(bool manual=false)
Helper to enter deep sleep mode.
void set_wakeup_pin(InternalGPIOPin *pin)
Set the pin to wake up to on the ESP32 once it's in deep sleep mode.
float get_loop_priority() const override
void set_sleep_duration(uint32_t time_ms)
Set the duration in ms the component should sleep once it's in deep sleep mode.
optional< uint32_t > run_duration_
void dump_config_platform_()
void set_ext1_wakeup(Ext1Wakeup ext1_wakeup)
float get_setup_priority() const override
optional< WakeupCauseToRunDuration > wakeup_cause_to_run_duration_
EnterDeepSleepAction(DeepSleepComponent *deep_sleep)
optional< uint8_t > hour_
TEMPLATABLE_VALUE(uint32_t, sleep_duration)
optional< uint8_t > second_
void set_until(uint8_t hour, uint8_t minute, uint8_t second)
DeepSleepComponent * deep_sleep_
void play(Ts... x) override
optional< uint8_t > minute_
time::RealTimeClock * time_
void set_time(time::RealTimeClock *time)
void play(Ts... x) override
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
ESPTime now()
Get the time in the currently defined timezone.
WakeupPinMode
The values of this enum define what should be done if deep sleep is set up with a wakeup pin on the E...
@ 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.
@ WAKEUP_PIN_MODE_IGNORE
Ignore the fact that we will wake up when going into deep sleep.
bool global_has_deep_sleep
Providing packet encoding functions for exchanging data with a remote host.
static int32_t timezone_offset()
time_t timestamp
unix epoch time (seconds since UTC Midnight January 1, 1970)
esp_sleep_ext1_wakeup_mode_t wakeup_mode