Skip to content

Commit

Permalink
Update xdrv_29_deepsleep.ino (#19492)
Browse files Browse the repository at this point in the history
  • Loading branch information
blacknell authored Sep 10, 2023
1 parent b117164 commit 728b1b2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tasmota/tasmota_xdrv_driver/xdrv_29_deepsleep.ino
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ void DeepSleepStart(void)
}

String dt = GetDT(RtcSettings.nextwakeup); // 2017-03-07T11:08:02
if (Settings->flag3.time_append_timezone) { // SetOption52 - Append timezone to JSON time
dt += GetTimeZone(); // 2017-03-07T11:08:02-07:00
}
// Limit sleeptime to DEEPSLEEP_MAX_CYCLE
// uint32_t deepsleep_sleeptime = DEEPSLEEP_MAX_CYCLE < (RtcSettings.nextwakeup - LocalTime()) ? (uint32_t)DEEPSLEEP_MAX_CYCLE : RtcSettings.nextwakeup - LocalTime();
deepsleep_sleeptime = tmin((uint32_t)DEEPSLEEP_MAX_CYCLE ,RtcSettings.nextwakeup - LocalTime());
Expand All @@ -138,13 +141,6 @@ void DeepSleepStart(void)
Response_P(PSTR("{\"" D_PRFX_DEEPSLEEP "\":{\"" D_JSON_TIME "\":\"%s\",\"" D_PRFX_DEEPSLEEP "\":%d,\"Wakeup\":%d}}"), (char*)dt.c_str(), LocalTime(), RtcSettings.nextwakeup);
MqttPublishPrefixTopicRulesProcess_P(TELE, PSTR(D_PRFX_DEEPSLEEP), true);

// Change LWT Topic to Sleep to ensure automation see different state
//GetTopic_P(stopic, TELE, TasmotaGlobal.mqtt_topic, S_LWT);
//Response_P(PSTR(D_PRFX_DEEPSLEEP));
//MqttPublish(stopic, true);

//MqttClient.disconnect(true);
//EspClient.stop();
WifiShutdown();
RtcSettings.ultradeepsleep = RtcSettings.nextwakeup - LocalTime();
RtcSettingsSave();
Expand Down

0 comments on commit 728b1b2

Please sign in to comment.