mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
ivt clock check dst
This commit is contained in:
@@ -1244,7 +1244,7 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
||||
tm_->tm_sec = telegram->message_data[5];
|
||||
tm_->tm_isdst = telegram->message_data[7] & 0x01;
|
||||
time_t ttime = mktime(tm_); // thermostat time
|
||||
bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont set clock on ivt, #439
|
||||
bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439
|
||||
// correct thermostat clock if we have valid ntp time, and could write the command
|
||||
if (!ivtclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) {
|
||||
double difference = difftime(now, ttime);
|
||||
@@ -1255,6 +1255,10 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
||||
}
|
||||
#ifndef EMSESP_STANDALONE
|
||||
if (!tset_ && tm_->tm_year > 110) { // emsesp clock not set, but thermostat clock
|
||||
if (ivtclock) {
|
||||
tm_->tm_isdst = -1; // determine dst
|
||||
ttime = mktime(tm_); // thermostat time
|
||||
}
|
||||
struct timeval newnow = {.tv_sec = ttime};
|
||||
settimeofday(&newnow, nullptr);
|
||||
LOG_INFO(F("ems-esp time set from thermostat"));
|
||||
|
||||
Reference in New Issue
Block a user