From f7a81c50b0755117c2e91192c33ec9e455abd088 Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Mon, 6 Jul 2026 08:24:43 +0200 Subject: [PATCH] fix standalone, formatting --- CHANGELOG_LATEST.md | 2 +- factory_settings.ini | 1 + interface/src/app/settings/NTPSettings.tsx | 12 +++++----- interface/src/types/ntp.ts | 2 +- lib_standalone/ESP32React.h | 8 +++++-- src/ESP32React/NTPSettingsService.cpp | 28 +++++++++++----------- src/ESP32React/NTPSettingsService.h | 14 +++++------ src/devices/thermostat.cpp | 8 +++---- 8 files changed, 40 insertions(+), 35 deletions(-) diff --git a/CHANGELOG_LATEST.md b/CHANGELOG_LATEST.md index 05949a47f..16f6bd845 100644 --- a/CHANGELOG_LATEST.md +++ b/CHANGELOG_LATEST.md @@ -21,4 +21,4 @@ For more details go to [emsesp.org](https://emsesp.org/). - call compute value direct, enlarge TCP stack [#3127](https://github.com/emsesp/EMS-ESP32/discussions/3127) - Dewtemperature for Easycontrol calculated by ems-esp [3135](https://github.com/emsesp/EMS-ESP32/issues/3135) -- add option for sync thermostat to ntp, allow different time zones [3148](https://github.com/emsesp/EMS-ESP32/discussions/3148), defaults to no sync. +- add option for sync thermostat to ntp, allow different time zones [3148](https://github.com/emsesp/EMS-ESP32/discussions/3148), **defaults to no sync**. diff --git a/factory_settings.ini b/factory_settings.ini index de76cc0f2..f11361498 100644 --- a/factory_settings.ini +++ b/factory_settings.ini @@ -24,6 +24,7 @@ build_flags = -D FACTORY_NTP_TIME_ZONE_LABEL=\"Europe/Amsterdam\" -D FACTORY_NTP_TIME_ZONE_FORMAT=\"CET-1CEST,M3.5.0,M10.5.0/3\" -D FACTORY_NTP_SERVER=\"time.google.com\" + -D FACTORY_NTP_THERMOSTAT_SYNC=0 ; MQTT settings -D FACTORY_MQTT_ENABLED=false diff --git a/interface/src/app/settings/NTPSettings.tsx b/interface/src/app/settings/NTPSettings.tsx index 51cd83157..7fc947b7b 100644 --- a/interface/src/app/settings/NTPSettings.tsx +++ b/interface/src/app/settings/NTPSettings.tsx @@ -71,7 +71,7 @@ const NTPSettings = () => { () => (data ? selectedTimeZone(data.tz_label, data.tz_format) : undefined), [data?.tz_label, data?.tz_format] ); -const selectedTzValueT = useMemo( + const selectedTzValueT = useMemo( () => (data ? selectedTimeZone(data.tz_label_t, data.tz_format_t) : undefined), [data?.tz_label_t, data?.tz_format_t] ); @@ -154,8 +154,8 @@ const selectedTzValueT = useMemo( }, [updateFormValue] ); - -const changeTimeZoneT = useCallback( + + const changeTimeZoneT = useCallback( (event: React.ChangeEvent) => { void updateState(readNTPSettings(), (settings: NTPSettingsType) => ({ ...settings, @@ -215,11 +215,11 @@ const changeTimeZoneT = useCallback( - {data.thermostat_option === 2 && ( + {data.thermostat_sync === 2 && ( telegram) { tm * tm_; bool sync = true; EMSESP::esp32React.getNTPSettingsService()->read([&](const NTPSettings & settings) { - switch (settings.thermostat_option) { + switch (settings.thermostat_sync) { default: sync = false; break; @@ -1773,9 +1773,9 @@ void Thermostat::process_RCTime(std::shared_ptr telegram) { strftime(newdatetime, sizeof(dateTime_), "%d.%m.%Y %H:%M", tm_); has_update(dateTime_, newdatetime, sizeof(dateTime_)); - bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439 + bool ivtclock = (telegram->message_data[0] & 0x80) == 0x80; // dont sync ivt-clock, #439 // bool junkersclock = model() == EMSdevice::EMS_DEVICE_FLAG_JUNKERS; - time_t ttime = mktime(tm_); // thermostat time + time_t ttime = mktime(tm_); // thermostat time // correct thermostat clock if we have valid ntp time, and could write the command // if (sync && !ivtclock && !junkersclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) { if (sync && !ivtclock && tset_ && EMSESP::system_.ntp_connected() && !EMSESP::system_.readonly_mode() && has_command(&dateTime_)) { @@ -3085,7 +3085,7 @@ bool Thermostat::set_datetime(const char * value, const int8_t id) { time_t now = time(nullptr); tm * tm_; EMSESP::esp32React.getNTPSettingsService()->read([&](const NTPSettings & settings) { - switch (settings.thermostat_option) { + switch (settings.thermostat_sync) { default: tm_ = localtime(&now); break;