diff --git a/src/AmsConfiguration.cpp b/src/AmsConfiguration.cpp index 1b0e3d23..9e0fa8c7 100644 --- a/src/AmsConfiguration.cpp +++ b/src/AmsConfiguration.cpp @@ -742,33 +742,10 @@ bool AmsConfiguration::loadConfig81(int address) { address += readInt(address, &i); setDebugLevel(i); - bool domo = false; - address += readBool(address, &domo); - if(domo) { - int domoELIDX; - address += readInt(address, &domoELIDX); - setDomoELIDX(domoELIDX); - int domoVL1IDX; - address += readInt(address, &domoVL1IDX); - setDomoVL1IDX(domoVL1IDX); - int domoVL2IDX; - address += readInt(address, &domoVL2IDX); - setDomoVL2IDX(domoVL2IDX); - int domoVL3IDX; - address += readInt(address, &domoVL3IDX); - setDomoVL3IDX(domoVL3IDX); - int domoCL1IDX; - address += readInt(address, &domoCL1IDX); - setDomoCL1IDX(domoCL1IDX); - - } else { - clearDomo(); - } - ackWifiChange(); return true; -} +} bool AmsConfiguration::save() { int address = EEPROM_CONFIG_ADDRESS; @@ -875,13 +852,13 @@ void AmsConfiguration::print(Print* debugger) debugger->printf("Vcc multiplier: %f\r\n", this->getVccMultiplier()); debugger->printf("Vcc boot limit: %f\r\n", this->getVccBootLimit()); - if(this->getDomoELIDX() > 0) { - debugger->printf("Domoticz ELIDX: %i\r\n", this->getDomoELIDX()); - debugger->printf("Domoticz VL1IDX: %i\r\n", this->getDomoVL1IDX()); - debugger->printf("Domoticz VL2IDX: %i\r\n", this->getDomoVL2IDX()); - debugger->printf("Domoticz VL3IDX: %i\r\n", this->getDomoVL3IDX()); - debugger->printf("Domoticz CL1IDX: %i\r\n", this->getDomoCL1IDX()); - } + //if(this->getDomoELIDX() > 0) { + debugger->printf("Domoticz ELIDX: %i\r\n", this->getDomoELIDX()); + debugger->printf("Domoticz VL1IDX: %i\r\n", this->getDomoVL1IDX()); + debugger->printf("Domoticz VL2IDX: %i\r\n", this->getDomoVL2IDX()); + debugger->printf("Domoticz VL3IDX: %i\r\n", this->getDomoVL3IDX()); + debugger->printf("Domoticz CL1IDX: %i\r\n", this->getDomoCL1IDX()); + //} debugger->println("-----------------------------------------------"); } diff --git a/src/AmsToMqttBridge.ino b/src/AmsToMqttBridge.ino index b39ed8df..a67480ba 100644 --- a/src/AmsToMqttBridge.ino +++ b/src/AmsToMqttBridge.ino @@ -22,7 +22,19 @@ #include #include #include +// Tz.h does not exist for esp32, need to include time.h, timezone offsets to be given given in sec. +#define NTP_SERVER "pool.ntp.org" // put your local NTP server here +#if defined(ESP8266) #include +#define MYTZ TZ_Europe_Oslo +#elif defined(ESP32) +#include +#define TZ 1 // (utc+) TZ in hours +#define DST_MN 60 // use 60mn for summer time in some countries +#define GMT_OFFSET_SEC 3600 * TZ // Do not change here... +#define DAYLIGHT_OFFSET_SEC 60 * DST_MN // Do not change here... +#endif + #if defined(ESP8266) ADC_MODE(ADC_VCC); @@ -239,7 +251,11 @@ void setup() { if(config.hasConfig()) { if(Debug.isActive(RemoteDebug::INFO)) config.print(&Debug); WiFi_connect(); - configTime(TZ_Europe_Oslo, "pool.ntp.org"); +#if defined(ESP8266) + configTime(MYTZ, NTP_SERVER); +#elif defined(ESP32) + configTime(GMT_OFFSET_SEC, DAYLIGHT_OFFSET_SEC, NTP_SERVER); +#endif //sntp_servermode_dhcp(0); // 0: disable obtaining SNTP servers from DHCP (enabled by default) } else { if(Debug.isActive(RemoteDebug::INFO)) { diff --git a/src/web/AmsWebServer.cpp b/src/web/AmsWebServer.cpp index 5280d26b..003d9f3c 100644 --- a/src/web/AmsWebServer.cpp +++ b/src/web/AmsWebServer.cpp @@ -341,7 +341,6 @@ void AmsWebServer::configDomoticzHtml() { server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); server.sendHeader("Pragma", "no-cache"); - html.replace("${config.domo}", config->getDomoELIDX() <= 0 ? "" : "checked"); if(config->getDomoELIDX() > 0){ html.replace("${config.domoELIDX}", String(config->getDomoELIDX())); } else { html.replace("${config.domoELIDX}", ""); } if(config->getDomoVL1IDX() > 0){ html.replace("${config.domoVL1IDX}", String(config->getDomoVL1IDX())); @@ -543,6 +542,7 @@ void AmsWebServer::dataJson() { json.createNestedObject("mqtt"); json["mqtt"]["lastError"] = (int) mqtt->lastError(); + // not in use anymore and assumes that if configured ELIDX is alsway given..... Remove?? String domoStatus; if(String(config->getDomoELIDX()).isEmpty()) { domoStatus = "secondary"; @@ -711,15 +711,11 @@ void AmsWebServer::handleSave() { } if(server.hasArg("domoConfig") && server.arg("domoConfig") == "true") { - if(server.hasArg("domo") && server.arg("domo") == "true") { - config->setDomoELIDX(server.arg("domoELIDX").toInt()); - config->setDomoVL1IDX(server.arg("domoVL1IDX").toInt()); - config->setDomoVL2IDX(server.arg("domoVL2IDX").toInt()); - config->setDomoVL3IDX(server.arg("domoVL3IDX").toInt()); - config->setDomoCL1IDX(server.arg("domoCL1IDX").toInt()); - } else { - config->clearDomo(); - } + config->setDomoELIDX(server.arg("domoELIDX").toInt()); + config->setDomoVL1IDX(server.arg("domoVL1IDX").toInt()); + config->setDomoVL2IDX(server.arg("domoVL2IDX").toInt()); + config->setDomoVL3IDX(server.arg("domoVL3IDX").toInt()); + config->setDomoCL1IDX(server.arg("domoCL1IDX").toInt()); }