mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
check readonly before set datetime to thermostat
This commit is contained in:
@@ -1244,7 +1244,8 @@ void Thermostat::process_RCTime(std::shared_ptr<const Telegram> telegram) {
|
|||||||
tm_->tm_sec = telegram->message_data[5];
|
tm_->tm_sec = telegram->message_data[5];
|
||||||
tm_->tm_isdst = telegram->message_data[7] & 0x01;
|
tm_->tm_isdst = telegram->message_data[7] & 0x01;
|
||||||
time_t ttime = mktime(tm_); // thermostat time
|
time_t ttime = mktime(tm_); // thermostat time
|
||||||
if (tset_ && EMSESP::system_.ntp_connected() && has_command(&dateTime_)) { // have NTP time and command
|
// correct thermostat clock if we have valid ntp time, and could write the command
|
||||||
|
if (tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) {
|
||||||
double difference = difftime(now, ttime);
|
double difference = difftime(now, ttime);
|
||||||
if (difference > 15 || difference < -15) {
|
if (difference > 15 || difference < -15) {
|
||||||
set_datetime("ntp", -1); // set from NTP
|
set_datetime("ntp", -1); // set from NTP
|
||||||
|
|||||||
Reference in New Issue
Block a user