Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally add timezone to DeepSleep wake up time #19492

Merged
merged 1 commit into from
Sep 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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