diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 56434faea..67a149347 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -305,6 +305,7 @@ struct TasmotaGlobal_t { bool ntp_force_sync; // Force NTP sync bool skip_light_fade; // Temporarily skip light fading bool restart_halt; // Do not restart but stay in wait loop + bool restart_deepsleep; // Do not restart but do deepsleep bool module_changed; // Indicate module changed since last restart bool wifi_stay_asleep; // Allow sleep only incase of ESP32 BLE bool no_autoexec; // Disable autoexec diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index c775b8aab..e18143040 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -1151,6 +1151,11 @@ void CmndRestart(void) } break; #endif // ESP32 + case 9: + TasmotaGlobal.restart_flag = 2; + TasmotaGlobal.restart_deepsleep = true; + ResponseCmndChar(PSTR("Go to sleep")); + break; case -1: CmndCrash(); // force a crash break; diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index 113181ce0..b7f51569f 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -1560,7 +1560,7 @@ void Every250mSeconds(void) TasmotaGlobal.restart_flag--; if (TasmotaGlobal.restart_flag <= 0) { - AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "%s"), (TasmotaGlobal.restart_halt) ? PSTR("Halted") : PSTR(D_RESTARTING)); + AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "%s"), (TasmotaGlobal.restart_halt) ? PSTR("Halted") : (TasmotaGlobal.restart_deepsleep) ? PSTR("Sleeping") : PSTR(D_RESTARTING)); EspRestart(); } } diff --git a/tasmota/tasmota_support/support_wifi.ino b/tasmota/tasmota_support/support_wifi.ino index c5189c344..210a73bcb 100644 --- a/tasmota/tasmota_support/support_wifi.ino +++ b/tasmota/tasmota_support/support_wifi.ino @@ -1161,7 +1161,7 @@ void EspRestart(void) WifiShutdown(true); CrashDumpClear(); // Clear the stack dump in RTC - if (TasmotaGlobal.restart_halt) { + if (TasmotaGlobal.restart_halt) { // Restart 2 while (1) { OsWatchLoop(); // Feed OsWatch timer to prevent restart SetLedLink(1); // Wifi led on @@ -1169,7 +1169,11 @@ void EspRestart(void) SetLedLink(0); // Wifi led off delay(800); // Satisfy SDK } - } else { + } + else if (TasmotaGlobal.restart_deepsleep) { // Restart 9 + ESP.deepSleep(0); // Deep sleep mode with only hardware triggered wake up + } + else { ESP_Restart(); } }