mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
removed timezone, handled via JS
This commit is contained in:
@@ -97,7 +97,6 @@ MyESP::MyESP() {
|
|||||||
_ntp_server = strdup(MYESP_NTP_SERVER);
|
_ntp_server = strdup(MYESP_NTP_SERVER);
|
||||||
;
|
;
|
||||||
_ntp_interval = 60;
|
_ntp_interval = 60;
|
||||||
_ntp_timezone = 1;
|
|
||||||
_ntp_enabled = false;
|
_ntp_enabled = false;
|
||||||
|
|
||||||
// get the build time
|
// 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
|
// NTP now that we have a WiFi connection
|
||||||
if (_ntp_enabled) {
|
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);
|
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_user = strdup(mqtt["user"] | "");
|
||||||
_mqtt_port = mqtt["port"] | MQTT_PORT;
|
_mqtt_port = mqtt["port"] | MQTT_PORT;
|
||||||
_mqtt_password = strdup(mqtt["password"] | "");
|
_mqtt_password = strdup(mqtt["password"] | "");
|
||||||
_mqtt_base = strdup(mqtt["base"] | "");
|
_mqtt_base = strdup(mqtt["base"] | MQTT_BASE_DEFAULT);
|
||||||
|
|
||||||
JsonObject ntp = doc["ntp"];
|
JsonObject ntp = doc["ntp"];
|
||||||
_ntp_server = strdup(ntp["server"] | "");
|
_ntp_server = strdup(ntp["server"] | "");
|
||||||
_ntp_interval = ntp["interval"] | 60;
|
_ntp_interval = ntp["interval"] | 60;
|
||||||
if (_ntp_interval == 0)
|
if (_ntp_interval == 0)
|
||||||
_ntp_interval = 60;
|
_ntp_interval = 60;
|
||||||
_ntp_timezone = ntp["timezone"] | 0;
|
_ntp_enabled = ntp["enabled"];
|
||||||
_ntp_enabled = ntp["enabled"];
|
|
||||||
|
|
||||||
myDebug_P(PSTR("[FS] System settings loaded"));
|
myDebug_P(PSTR("[FS] System settings loaded"));
|
||||||
// serializeJsonPretty(doc, Serial); // turn on for debugging
|
// serializeJsonPretty(doc, Serial); // turn on for debugging
|
||||||
@@ -1800,7 +1798,6 @@ bool MyESP::_fs_writeConfig() {
|
|||||||
JsonObject ntp = doc.createNestedObject("ntp");
|
JsonObject ntp = doc.createNestedObject("ntp");
|
||||||
ntp["server"] = _ntp_server;
|
ntp["server"] = _ntp_server;
|
||||||
ntp["interval"] = _ntp_interval;
|
ntp["interval"] = _ntp_interval;
|
||||||
ntp["timezone"] = _ntp_timezone;
|
|
||||||
ntp["enabled"] = _ntp_enabled;
|
ntp["enabled"] = _ntp_enabled;
|
||||||
|
|
||||||
bool ok = fs_saveConfig(root); // save it
|
bool ok = fs_saveConfig(root); // save it
|
||||||
@@ -2695,7 +2692,6 @@ void MyESP::_sendTime() {
|
|||||||
JsonObject root = doc.to<JsonObject>();
|
JsonObject root = doc.to<JsonObject>();
|
||||||
root["command"] = "gettime";
|
root["command"] = "gettime";
|
||||||
root["epoch"] = now();
|
root["epoch"] = now();
|
||||||
root["timezone"] = _ntp_timezone;
|
|
||||||
|
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
size_t len = serializeJson(root, buffer);
|
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
|
// write a log message if we're not using NTP, otherwise wait for the internet time to arrive
|
||||||
if (!_ntp_enabled) {
|
if (!_ntp_enabled) {
|
||||||
_writeEvent("INFO", "sys", "System booted", "(elapsed time shown)");
|
_writeEvent("INFO", "sys", "System booted", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ extern struct rst_info resetInfo;
|
|||||||
#define MQTT_TOPIC_RESTART "restart"
|
#define MQTT_TOPIC_RESTART "restart"
|
||||||
#define MQTT_WILL_ONLINE_PAYLOAD "online" // for last will & testament payload
|
#define MQTT_WILL_ONLINE_PAYLOAD "online" // for last will & testament payload
|
||||||
#define MQTT_WILL_OFFLINE_PAYLOAD "offline" // 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_RETAIN false
|
||||||
#define MQTT_KEEPALIVE 60 // 1 minute
|
#define MQTT_KEEPALIVE 60 // 1 minute
|
||||||
#define MQTT_QOS 1
|
#define MQTT_QOS 1
|
||||||
@@ -457,7 +458,6 @@ class MyESP {
|
|||||||
void _webResetAllPage();
|
void _webResetAllPage();
|
||||||
|
|
||||||
// ntp
|
// ntp
|
||||||
uint8_t _ntp_timezone;
|
|
||||||
char * _ntp_server;
|
char * _ntp_server;
|
||||||
uint8_t _ntp_interval;
|
uint8_t _ntp_interval;
|
||||||
bool _ntp_enabled;
|
bool _ntp_enabled;
|
||||||
|
|||||||
11
src/Ntp.cpp
11
src/Ntp.cpp
@@ -5,17 +5,14 @@
|
|||||||
#include "Ntp.h"
|
#include "Ntp.h"
|
||||||
|
|
||||||
char * NtpClient::TimeServerName;
|
char * NtpClient::TimeServerName;
|
||||||
int8_t NtpClient::timezone;
|
|
||||||
time_t NtpClient::syncInterval;
|
time_t NtpClient::syncInterval;
|
||||||
IPAddress NtpClient::timeServer;
|
IPAddress NtpClient::timeServer;
|
||||||
|
AsyncUDP NtpClient::udpListener;
|
||||||
|
byte NtpClient::NTPpacket[NTP_PACKET_SIZE];
|
||||||
|
|
||||||
AsyncUDP NtpClient::udpListener;
|
void ICACHE_FLASH_ATTR NtpClient::Ntp(const char * server, time_t syncMins) {
|
||||||
byte NtpClient::NTPpacket[NTP_PACKET_SIZE];
|
|
||||||
|
|
||||||
void ICACHE_FLASH_ATTR NtpClient::Ntp(const char * server, int8_t tz, time_t syncSecs) {
|
|
||||||
TimeServerName = strdup(server);
|
TimeServerName = strdup(server);
|
||||||
timezone = tz;
|
syncInterval = syncMins * 60; // convert to seconds
|
||||||
syncInterval = syncSecs;
|
|
||||||
WiFi.hostByName(TimeServerName, timeServer);
|
WiFi.hostByName(TimeServerName, timeServer);
|
||||||
setSyncProvider(getNtpTime);
|
setSyncProvider(getNtpTime);
|
||||||
setSyncInterval(syncInterval);
|
setSyncInterval(syncInterval);
|
||||||
|
|||||||
@@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
class NtpClient {
|
class NtpClient {
|
||||||
public:
|
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();
|
ICACHE_FLASH_ATTR virtual ~NtpClient();
|
||||||
|
|
||||||
static char * TimeServerName;
|
static char * TimeServerName;
|
||||||
static IPAddress timeServer;
|
static IPAddress timeServer;
|
||||||
static int8_t timezone;
|
|
||||||
static time_t syncInterval;
|
static time_t syncInterval;
|
||||||
|
|
||||||
static AsyncUDP udpListener;
|
static AsyncUDP udpListener;
|
||||||
|
|||||||
28
src/ems.h
28
src/ems.h
@@ -409,20 +409,20 @@ void ems_startupTelegrams();
|
|||||||
bool ems_checkEMSBUSAlive();
|
bool ems_checkEMSBUSAlive();
|
||||||
void ems_clearDeviceList();
|
void ems_clearDeviceList();
|
||||||
|
|
||||||
void ems_setThermostatTemp(float temperature, uint8_t temptype = 0);
|
void ems_setThermostatTemp(float temperature, uint8_t temptype = 0);
|
||||||
void ems_setThermostatMode(uint8_t mode);
|
void ems_setThermostatMode(uint8_t mode);
|
||||||
void ems_setThermostatHC(uint8_t hc);
|
void ems_setThermostatHC(uint8_t hc);
|
||||||
void ems_setWarmWaterTemp(uint8_t temperature);
|
void ems_setWarmWaterTemp(uint8_t temperature);
|
||||||
void ems_setFlowTemp(uint8_t temperature);
|
void ems_setFlowTemp(uint8_t temperature);
|
||||||
void ems_setWarmWaterActivated(bool activated);
|
void ems_setWarmWaterActivated(bool activated);
|
||||||
void ems_setWarmTapWaterActivated(bool activated);
|
void ems_setWarmTapWaterActivated(bool activated);
|
||||||
void ems_setPoll(bool b);
|
void ems_setPoll(bool b);
|
||||||
void ems_setLogging(_EMS_SYS_LOGGING loglevel);
|
void ems_setLogging(_EMS_SYS_LOGGING loglevel);
|
||||||
void ems_setEmsRefreshed(bool b);
|
void ems_setEmsRefreshed(bool b);
|
||||||
void ems_setWarmWaterModeComfort(uint8_t comfort);
|
void ems_setWarmWaterModeComfort(uint8_t comfort);
|
||||||
void ems_setModels();
|
void ems_setModels();
|
||||||
void ems_setTxDisabled(bool b);
|
void ems_setTxDisabled(bool b);
|
||||||
bool ems_getTxDisabled();
|
bool ems_getTxDisabled();
|
||||||
|
|
||||||
char * ems_getThermostatDescription(char * buffer, bool name_only = false);
|
char * ems_getThermostatDescription(char * buffer, bool name_only = false);
|
||||||
char * ems_getBoilerDescription(char * buffer, bool name_only = false);
|
char * ems_getBoilerDescription(char * buffer, bool name_only = false);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#define APP_NAME "EMS-ESP"
|
#define APP_NAME "EMS-ESP"
|
||||||
#define APP_VERSION "1.9.0b3"
|
#define APP_VERSION "1.9.0b4"
|
||||||
#define APP_HOSTNAME "ems-esp"
|
#define APP_HOSTNAME "ems-esp"
|
||||||
#define APP_URL "https://github.com/proddy/EMS-ESP"
|
#define APP_URL "https://github.com/proddy/EMS-ESP"
|
||||||
#define APP_UPDATEURL "https://api.github.com/repos/proddy/EMS-ESP/releases/latest"
|
#define APP_UPDATEURL "https://api.github.com/repos/proddy/EMS-ESP/releases/latest"
|
||||||
|
|||||||
Reference in New Issue
Block a user