diff --git a/src/MyESP.cpp b/src/MyESP.cpp index 616e69109..2e2bb3540 100644 --- a/src/MyESP.cpp +++ b/src/MyESP.cpp @@ -97,7 +97,6 @@ MyESP::MyESP() { _ntp_server = strdup(MYESP_NTP_SERVER); ; _ntp_interval = 60; - _ntp_timezone = 1; _ntp_enabled = false; // get the build time @@ -232,7 +231,7 @@ void MyESP::_wifiCallback(justwifi_messages_t code, char * parameter) { // NTP now that we have a WiFi connection if (_ntp_enabled) { - NTP.Ntp(_ntp_server, _ntp_timezone, _ntp_interval * 60); // set up NTP server + NTP.Ntp(_ntp_server, _ntp_interval); // set up NTP server myDebug_P(PSTR("[NTP] NTP internet time enabled via server %s"), _ntp_server); } @@ -1626,15 +1625,14 @@ bool MyESP::_fs_loadConfig() { _mqtt_user = strdup(mqtt["user"] | ""); _mqtt_port = mqtt["port"] | MQTT_PORT; _mqtt_password = strdup(mqtt["password"] | ""); - _mqtt_base = strdup(mqtt["base"] | ""); + _mqtt_base = strdup(mqtt["base"] | MQTT_BASE_DEFAULT); JsonObject ntp = doc["ntp"]; _ntp_server = strdup(ntp["server"] | ""); _ntp_interval = ntp["interval"] | 60; if (_ntp_interval == 0) _ntp_interval = 60; - _ntp_timezone = ntp["timezone"] | 0; - _ntp_enabled = ntp["enabled"]; + _ntp_enabled = ntp["enabled"]; myDebug_P(PSTR("[FS] System settings loaded")); // serializeJsonPretty(doc, Serial); // turn on for debugging @@ -1800,7 +1798,6 @@ bool MyESP::_fs_writeConfig() { JsonObject ntp = doc.createNestedObject("ntp"); ntp["server"] = _ntp_server; ntp["interval"] = _ntp_interval; - ntp["timezone"] = _ntp_timezone; ntp["enabled"] = _ntp_enabled; bool ok = fs_saveConfig(root); // save it @@ -2695,7 +2692,6 @@ void MyESP::_sendTime() { JsonObject root = doc.to(); root["command"] = "gettime"; root["epoch"] = now(); - root["timezone"] = _ntp_timezone; char buffer[100]; size_t len = serializeJson(root, buffer); @@ -2742,7 +2738,7 @@ void MyESP::_bootupSequence() { // write a log message if we're not using NTP, otherwise wait for the internet time to arrive if (!_ntp_enabled) { - _writeEvent("INFO", "sys", "System booted", "(elapsed time shown)"); + _writeEvent("INFO", "sys", "System booted", ""); } } } diff --git a/src/MyESP.h b/src/MyESP.h index 4cbaae2ac..07289c714 100644 --- a/src/MyESP.h +++ b/src/MyESP.h @@ -78,6 +78,7 @@ extern struct rst_info resetInfo; #define MQTT_TOPIC_RESTART "restart" #define MQTT_WILL_ONLINE_PAYLOAD "online" // for last will & testament payload #define MQTT_WILL_OFFLINE_PAYLOAD "offline" // for last will & testament payload +#define MQTT_BASE_DEFAULT "home" // default MQTT prefix to topics #define MQTT_RETAIN false #define MQTT_KEEPALIVE 60 // 1 minute #define MQTT_QOS 1 @@ -457,7 +458,6 @@ class MyESP { void _webResetAllPage(); // ntp - uint8_t _ntp_timezone; char * _ntp_server; uint8_t _ntp_interval; bool _ntp_enabled; diff --git a/src/Ntp.cpp b/src/Ntp.cpp index e44563b61..679bbae7b 100644 --- a/src/Ntp.cpp +++ b/src/Ntp.cpp @@ -5,17 +5,14 @@ #include "Ntp.h" char * NtpClient::TimeServerName; -int8_t NtpClient::timezone; time_t NtpClient::syncInterval; IPAddress NtpClient::timeServer; +AsyncUDP NtpClient::udpListener; +byte NtpClient::NTPpacket[NTP_PACKET_SIZE]; -AsyncUDP NtpClient::udpListener; -byte NtpClient::NTPpacket[NTP_PACKET_SIZE]; - -void ICACHE_FLASH_ATTR NtpClient::Ntp(const char * server, int8_t tz, time_t syncSecs) { +void ICACHE_FLASH_ATTR NtpClient::Ntp(const char * server, time_t syncMins) { TimeServerName = strdup(server); - timezone = tz; - syncInterval = syncSecs; + syncInterval = syncMins * 60; // convert to seconds WiFi.hostByName(TimeServerName, timeServer); setSyncProvider(getNtpTime); setSyncInterval(syncInterval); diff --git a/src/Ntp.h b/src/Ntp.h index a13fd9da6..8371d1bb8 100644 --- a/src/Ntp.h +++ b/src/Ntp.h @@ -16,12 +16,11 @@ class NtpClient { public: - void ICACHE_FLASH_ATTR Ntp(const char * server, int8_t tz, time_t syncSecs); + void ICACHE_FLASH_ATTR Ntp(const char * server, time_t syncMins); ICACHE_FLASH_ATTR virtual ~NtpClient(); static char * TimeServerName; static IPAddress timeServer; - static int8_t timezone; static time_t syncInterval; static AsyncUDP udpListener; diff --git a/src/ems.h b/src/ems.h index 89e491654..b34e328be 100644 --- a/src/ems.h +++ b/src/ems.h @@ -409,20 +409,20 @@ void ems_startupTelegrams(); bool ems_checkEMSBUSAlive(); void ems_clearDeviceList(); -void ems_setThermostatTemp(float temperature, uint8_t temptype = 0); -void ems_setThermostatMode(uint8_t mode); -void ems_setThermostatHC(uint8_t hc); -void ems_setWarmWaterTemp(uint8_t temperature); -void ems_setFlowTemp(uint8_t temperature); -void ems_setWarmWaterActivated(bool activated); -void ems_setWarmTapWaterActivated(bool activated); -void ems_setPoll(bool b); -void ems_setLogging(_EMS_SYS_LOGGING loglevel); -void ems_setEmsRefreshed(bool b); -void ems_setWarmWaterModeComfort(uint8_t comfort); -void ems_setModels(); -void ems_setTxDisabled(bool b); -bool ems_getTxDisabled(); +void ems_setThermostatTemp(float temperature, uint8_t temptype = 0); +void ems_setThermostatMode(uint8_t mode); +void ems_setThermostatHC(uint8_t hc); +void ems_setWarmWaterTemp(uint8_t temperature); +void ems_setFlowTemp(uint8_t temperature); +void ems_setWarmWaterActivated(bool activated); +void ems_setWarmTapWaterActivated(bool activated); +void ems_setPoll(bool b); +void ems_setLogging(_EMS_SYS_LOGGING loglevel); +void ems_setEmsRefreshed(bool b); +void ems_setWarmWaterModeComfort(uint8_t comfort); +void ems_setModels(); +void ems_setTxDisabled(bool b); +bool ems_getTxDisabled(); char * ems_getThermostatDescription(char * buffer, bool name_only = false); char * ems_getBoilerDescription(char * buffer, bool name_only = false); diff --git a/src/version.h b/src/version.h index a92a8cd4c..18d69a72e 100644 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,6 @@ #define APP_NAME "EMS-ESP" -#define APP_VERSION "1.9.0b3" +#define APP_VERSION "1.9.0b4" #define APP_HOSTNAME "ems-esp" #define APP_URL "https://github.com/proddy/EMS-ESP" #define APP_UPDATEURL "https://api.github.com/repos/proddy/EMS-ESP/releases/latest"