Stripped HTML to improve stability

This commit is contained in:
Gunnar Skjold 2021-01-14 20:03:49 +01:00
parent 037bac24de
commit a830a52863
15 changed files with 433 additions and 403 deletions

View File

@ -459,9 +459,9 @@ void loop() {
delay(1);
readHanPort();
if(WiFi.status() == WL_CONNECTED) {
//if(eapi.loop()) {
// sendPricesToMqtt();
//}
if(eapi.loop()) {
sendPricesToMqtt();
}
}
ws.loop();
delay(1); // Needed for auto modem sleep
@ -1090,7 +1090,7 @@ void MQTT_connect() {
if(Debug.isActive(RemoteDebug::WARNING)) debugW("No MQTT config");
return;
}
if(millis() - lastMqttRetry < (mqtt.lastError() == 0 ? 5000 : 60000)) {
if(millis() - lastMqttRetry < (mqtt.lastError() == 0 || config.isMqttChanged() ? 5000 : 30000)) {
yield();
return;
}

View File

@ -106,7 +106,8 @@ bool EntsoeApi::loop() {
tomorrow = NULL;
midnightMillis = 0; // Force new midnight millis calculation
} else {
if(today == NULL) {
if(today == NULL && (lastTodayFetch == 0 || now - lastTodayFetch > 60000)) {
lastTodayFetch = now;
time_t e1 = time(nullptr) - (SECS_PER_DAY * 1);
time_t e2 = e1 + SECS_PER_DAY;
tmElements_t d1, d2;
@ -134,8 +135,9 @@ bool EntsoeApi::loop() {
if(tomorrow == NULL
&& midnightMillis - now < 39600000
&& (lastTomorrowFetch == 0 || now - lastTomorrowFetch > 3600000)
&& (lastTomorrowFetch == 0 || now - lastTomorrowFetch > 60000)
) {
lastTomorrowFetch = now;
time_t e1 = time(nullptr);
time_t e2 = e1 + SECS_PER_DAY;
tmElements_t d1, d2;
@ -159,7 +161,6 @@ bool EntsoeApi::loop() {
delete a44;
tomorrow = NULL;
}
lastTomorrowFetch = now;
}
}
return ret;
@ -167,14 +168,15 @@ bool EntsoeApi::loop() {
bool EntsoeApi::retrieve(const char* url, Stream* doc) {
WiFiClientSecure client;
#if defined(ESP8266)
#if defined(ESP8266)
client.setBufferSizes(512, 512);
client.setInsecure();
#endif
#endif
HTTPClient https;
#if defined(ESP8266)
#if defined(ESP8266)
https.setFollowRedirects(true);
#endif
#endif
if(https.begin(client, url)) {
int status = https.GET();
@ -187,10 +189,22 @@ bool EntsoeApi::retrieve(const char* url, Stream* doc) {
printE(https.errorToString(status));
printI(url);
printD(https.getString());
#if defined(ESP8266)
char buf[256];
client.getLastSSLError(buf,256);
printE(buf);
#endif
https.end();
return false;
}
} else {
#if defined(ESP8266)
char buf[256];
client.getLastSSLError(buf,256);
printE(buf);
#endif
return false;
}
}

View File

@ -28,6 +28,7 @@ private:
char token[37]; // UUID + null terminator
uint64_t midnightMillis = 0;
uint64_t lastTodayFetch = 0;
uint64_t lastTomorrowFetch = 0;
uint64_t lastCurrencyFetch = 0;
EntsoeA44Parser* today = NULL;

View File

@ -7,11 +7,11 @@
#include "root/index_html.h"
#include "root/application_js.h"
#include "root/setup_html.h"
#include "root/configmeter_html.h"
#include "root/configwifi_html.h"
#include "root/configmqtt_html.h"
#include "root/configweb_html.h"
#include "root/configdomoticz_html.h"
#include "root/meter_html.h"
#include "root/wifi_html.h"
#include "root/mqtt_html.h"
#include "root/web_html.h"
#include "root/domoticz_html.h"
#include "root/entsoe_html.h"
#include "root/ntp_html.h"
#include "root/gpio_html.h"
@ -26,6 +26,7 @@
#include "root/reset_html.h"
#include "root/temperature_html.h"
#include "root/price_html.h"
#include "root/notfound_html.h"
#include "base64.h"
@ -46,11 +47,11 @@ void AmsWebServer::setup(AmsConfiguration* config, MQTTClient* mqtt) {
server.on("/temperature", HTTP_POST, std::bind(&AmsWebServer::temperaturePost, this));
server.on("/temperature.json", HTTP_GET, std::bind(&AmsWebServer::temperatureJson, this));
server.on("/price", HTTP_GET, std::bind(&AmsWebServer::price, this));
server.on("/config-meter", HTTP_GET, std::bind(&AmsWebServer::configMeterHtml, this));
server.on("/config-wifi", HTTP_GET, std::bind(&AmsWebServer::configWifiHtml, this));
server.on("/config-mqtt", HTTP_GET, std::bind(&AmsWebServer::configMqttHtml, this));
server.on("/config-web", HTTP_GET, std::bind(&AmsWebServer::configWebHtml, this));
server.on("/config-domoticz",HTTP_GET, std::bind(&AmsWebServer::configDomoticzHtml, this));
server.on("/meter", HTTP_GET, std::bind(&AmsWebServer::configMeterHtml, this));
server.on("/wifi", HTTP_GET, std::bind(&AmsWebServer::configWifiHtml, this));
server.on("/mqtt", HTTP_GET, std::bind(&AmsWebServer::configMqttHtml, this));
server.on("/web", HTTP_GET, std::bind(&AmsWebServer::configWebHtml, this));
server.on("/domoticz",HTTP_GET, std::bind(&AmsWebServer::configDomoticzHtml, this));
server.on("/entsoe",HTTP_GET, std::bind(&AmsWebServer::configEntsoeHtml, this));
server.on("/boot.css", HTTP_GET, std::bind(&AmsWebServer::bootCss, this));
server.on("/gaugemeter.js", HTTP_GET, std::bind(&AmsWebServer::gaugemeterJs, this));
@ -292,41 +293,38 @@ void AmsWebServer::indexHtml() {
double tqi = data.getReactiveImportCounter();
double tqo = data.getReactiveExportCounter();
html.replace("${data.P}", String(data.getActiveImportPower()));
html.replace("${data.PO}", String(data.getActiveExportPower()));
html.replace("${display.export}", config->getProductionCapacity() > 0 ? "" : "none");
html.replace("${display.nonexport}", config->getProductionCapacity() > 0 ? "none" : "");
html.replace("${text.import}", config->getProductionCapacity() > 0 ? "Import" : "Use");
html.replace("${display.3p}", data.isThreePhase() ? "" : "none");
html.replace("{P}", String(data.getActiveImportPower()));
html.replace("{PO}", String(data.getActiveExportPower()));
html.replace("{de}", config->getProductionCapacity() > 0 ? "" : "none");
html.replace("{dn}", config->getProductionCapacity() > 0 ? "none" : "");
html.replace("{ti}", config->getProductionCapacity() > 0 ? "Import" : "Use");
html.replace("{3p}", data.isThreePhase() ? "" : "none");
html.replace("${data.U1}", u1 > 0 ? String(u1, 1) : "");
html.replace("${data.I1}", u1 > 0 ? String(i1, 1) : "");
html.replace("{U1}", u1 > 0 ? String(u1, 1) : "");
html.replace("{I1}", u1 > 0 ? String(i1, 1) : "");
html.replace("${data.U2}", u2 > 0 ? String(u2, 1) : "");
html.replace("${data.I2}", u2 > 0 ? String(i2, 1) : "");
html.replace("{U2}", u2 > 0 ? String(u2, 1) : "");
html.replace("{I2}", u2 > 0 ? String(i2, 1) : "");
html.replace("${data.U3}", u3 > 0 ? String(u3, 1) : "");
html.replace("${data.I3}", u3 > 0 ? String(i3, 1) : "");
html.replace("{U3}", u3 > 0 ? String(u3, 1) : "");
html.replace("{I3}", u3 > 0 ? String(i3, 1) : "");
html.replace("${data.tPI}", tpi > 0 ? String(tpi, 1) : "");
html.replace("${data.tPO}", tpi > 0 ? String(tpo, 1) : "");
html.replace("${data.tQI}", tpi > 0 ? String(tqi, 1) : "");
html.replace("${data.tQO}", tpi > 0 ? String(tqo, 1) : "");
html.replace("${display.accumulative}", tpi > 0 ? "" : "none");
html.replace("{tPI}", tpi > 0 ? String(tpi, 1) : "");
html.replace("{tPO}", tpi > 0 ? String(tpo, 1) : "");
html.replace("{tQI}", tpi > 0 ? String(tqi, 1) : "");
html.replace("{tQO}", tpi > 0 ? String(tqo, 1) : "");
html.replace("{da}", tpi > 0 ? "" : "none");
double vcc = hw->getVcc();
html.replace("${vcc}", vcc > 0 ? String(vcc, 2) : "");
html.replace("{vcc}", vcc > 0 ? String(vcc, 2) : "");
double temp = hw->getTemperature();
html.replace("${temp}", temp > 0 ? String(temp, 1) : "");
html.replace("${display.temp}", temp != DEVICE_DISCONNECTED_C ? "" : "none");
html.replace("{temp}", temp > 0 ? String(temp, 1) : "");
int rssi = hw->getWifiRssi();
html.replace("${wifi.rssi}", vcc > 0 ? String(rssi) : "");
html.replace("${wifi.channel}", WiFi.channel() > 0 ? String(WiFi.channel()) : "");
html.replace("${wifi.ssid}", !WiFi.SSID().isEmpty() ? String(WiFi.SSID()) : "");
html.replace("{rssi}", vcc > 0 ? String(rssi) : "");
html.replace("${currentSeconds}", String((uint32_t)(millis64()/1000), 10));
html.replace("{cs}", String((uint32_t)(millis64()/1000), 10));
server.setContentLength(html.length() + HEAD_HTML_LEN + FOOT_HTML_LEN);
server.send_P(200, "text/html", HEAD_HTML);
@ -343,40 +341,45 @@ void AmsWebServer::applicationJs() {
}
void AmsWebServer::configMeterHtml() {
printD("Serving /config-meter.html over http...");
printD("Serving /meter.html over http...");
if(!checkSecurity(1))
return;
String html = String((const __FlashStringHelper*) CONFIGMETER_HTML);
String html = String((const __FlashStringHelper*) METER_HTML);
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
html.replace("${config.meterType}", String(config->getMainFuse()));
html.replace("{m}", String(config->getMainFuse()));
for(int i = 0; i<5; i++) {
html.replace("${config.meterType" + String(i) + "}", config->getMeterType() == i ? "selected" : "");
html.replace("{m" + String(i) + "}", config->getMeterType() == i ? "selected" : "");
}
html.replace("${config.distributionSystem}", String(config->getDistributionSystem()));
html.replace("{d}", String(config->getDistributionSystem()));
for(int i = 0; i<3; i++) {
html.replace("${config.distributionSystem" + String(i) + "}", config->getDistributionSystem() == i ? "selected" : "");
html.replace("{d" + String(i) + "}", config->getDistributionSystem() == i ? "selected" : "");
}
html.replace("${config.mainFuse}", String(config->getMainFuse()));
html.replace("{f}", String(config->getMainFuse()));
for(int i = 0; i<64; i++) {
html.replace("${config.mainFuse" + String(i) + "}", config->getMainFuse() == i ? "selected" : "");
html.replace("{f" + String(i) + "}", config->getMainFuse() == i ? "selected" : "");
}
html.replace("${config.productionCapacity}", String(config->getProductionCapacity()));
html.replace("{p}", String(config->getProductionCapacity()));
String encryptionKeyHex = "0x";
encryptionKeyHex += toHex(config->getMeterEncryptionKey(), 16);
html.replace("${config.meterEncryptionKey}", encryptionKeyHex);
if(config->getMeterType() == METER_TYPE_OMNIPOWER) {
String encryptionKeyHex = "0x";
encryptionKeyHex += toHex(config->getMeterEncryptionKey(), 16);
html.replace("{e}", encryptionKeyHex);
String authenticationKeyHex = "0x";
authenticationKeyHex += toHex(config->getMeterAuthenticationKey(), 16);
html.replace("${config.meterAuthenticationKey}", authenticationKeyHex);
String authenticationKeyHex = "0x";
authenticationKeyHex += toHex(config->getMeterAuthenticationKey(), 16);
html.replace("{a}", authenticationKeyHex);
} else {
html.replace("{e}", "");
html.replace("{a}", "");
}
html.replace("${config.substituteMissing}", config->isSubstituteMissing() ? "checked" : "");
html.replace("${config.sendUnknown}", config->isSendUnknown() ? "checked" : "");
html.replace("{s}", config->isSubstituteMissing() ? "checked" : "");
html.replace("{u}", config->isSendUnknown() ? "checked" : "");
server.setContentLength(html.length() + HEAD_HTML_LEN + FOOT_HTML_LEN);
server.send_P(200, "text/html", HEAD_HTML);
@ -403,26 +406,26 @@ void AmsWebServer::fromHex(uint8_t *out, String in, uint8_t size) {
}
void AmsWebServer::configWifiHtml() {
printD("Serving /config-wifi.html over http...");
printD("Serving /wifi.html over http...");
if(!checkSecurity(1))
return;
String html = String((const __FlashStringHelper*) CONFIGWIFI_HTML);
String html = String((const __FlashStringHelper*) WIFI_HTML);
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
html.replace("${config.wifiSsid}", config->getWifiSsid());
html.replace("${config.wifiPassword}", config->getWifiPassword());
html.replace("${config.wifiStaticIp}", strlen(config->getWifiIp()) > 0 ? "checked" : "");
html.replace("${config.wifiIp}", config->getWifiIp());
html.replace("${config.wifiGw}", config->getWifiGw());
html.replace("${config.wifiSubnet}", config->getWifiSubnet());
html.replace("${config.wifiDns1}", config->getWifiDns1());
html.replace("${config.wifiDns2}", config->getWifiDns2());
html.replace("${config.wifiHostname}", config->getWifiHostname());
html.replace("${config.mDnsEnable}", config->isMdnsEnable() ? "checked" : "");
html.replace("{s}", config->getWifiSsid());
html.replace("{p}", config->getWifiPassword());
html.replace("{st}", strlen(config->getWifiIp()) > 0 ? "checked" : "");
html.replace("{i}", config->getWifiIp());
html.replace("{g}", config->getWifiGw());
html.replace("{sn}", config->getWifiSubnet());
html.replace("{d1}", config->getWifiDns1());
html.replace("{d2}", config->getWifiDns2());
html.replace("{h}", config->getWifiHostname());
html.replace("{m}", config->isMdnsEnable() ? "checked" : "");
server.setContentLength(html.length() + HEAD_HTML_LEN + FOOT_HTML_LEN);
server.send_P(200, "text/html", HEAD_HTML);
@ -431,51 +434,50 @@ void AmsWebServer::configWifiHtml() {
}
void AmsWebServer::configMqttHtml() {
printD("Serving /config-mqtt.html over http...");
printD("Serving /mqtt.html over http...");
if(!checkSecurity(1))
return;
String html = String((const __FlashStringHelper*) CONFIGMQTT_HTML);
String html = String((const __FlashStringHelper*) MQTT_HTML);
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
html.replace("${config.mqtt}", strlen(config->getMqttHost()) == 0 ? "" : "checked");
html.replace("${config.mqttHost}", config->getMqttHost());
html.replace("{m}", strlen(config->getMqttHost()) == 0 ? "" : "checked");
html.replace("{h}", config->getMqttHost());
if(config->getMqttPort() > 0) {
html.replace("${config.mqttPort}", String(config->getMqttPort()));
html.replace("{p}", String(config->getMqttPort()));
} else {
html.replace("${config.mqttPort}", String(1883));
html.replace("{p}", String(1883));
}
html.replace("${config.mqttClientId}", config->getMqttClientId());
html.replace("${config.mqttPublishTopic}", config->getMqttPublishTopic());
html.replace("${config.mqttSubscribeTopic}", config->getMqttSubscribeTopic());
html.replace("${config.mqttUser}", config->getMqttUser());
html.replace("${config.mqttPassword}", config->getMqttPassword());
html.replace("${config.mqttPayloadFormat}", String(config->getMqttPayloadFormat()));
html.replace("{i}", config->getMqttClientId());
html.replace("{t}", config->getMqttPublishTopic());
html.replace("{st}", config->getMqttSubscribeTopic());
html.replace("{u}", config->getMqttUser());
html.replace("{pw}", config->getMqttPassword());
html.replace("{f}", String(config->getMqttPayloadFormat()));
for(int i = 0; i<4; i++) {
html.replace("${config.mqttPayloadFormat" + String(i) + "}", config->getMqttPayloadFormat() == i ? "selected" : "");
html.replace("{f" + String(i) + "}", config->getMqttPayloadFormat() == i ? "selected" : "");
}
html.replace("${config.mqttSsl}", config->isMqttSsl() ? "checked" : "");
html.replace("${display.ssl}", config->isMqttSsl() ? "" : "none");
html.replace("{s}", config->isMqttSsl() ? "checked" : "");
if(SPIFFS.begin()) {
html.replace("${display.ca.upload}", SPIFFS.exists(FILE_MQTT_CA) ? "none" : "");
html.replace("${display.ca.file}", SPIFFS.exists(FILE_MQTT_CA) ? "" : "none");
html.replace("${display.cert.upload}", SPIFFS.exists(FILE_MQTT_CERT) ? "none" : "");
html.replace("${display.cert.file}", SPIFFS.exists(FILE_MQTT_CERT) ? "" : "none");
html.replace("${display.key.upload}", SPIFFS.exists(FILE_MQTT_KEY) ? "none" : "");
html.replace("${display.key.file}", SPIFFS.exists(FILE_MQTT_KEY) ? "" : "none");
html.replace("{dcu}", SPIFFS.exists(FILE_MQTT_CA) ? "none" : "");
html.replace("{dcf}", SPIFFS.exists(FILE_MQTT_CA) ? "" : "none");
html.replace("{deu}", SPIFFS.exists(FILE_MQTT_CERT) ? "none" : "");
html.replace("{def}", SPIFFS.exists(FILE_MQTT_CERT) ? "" : "none");
html.replace("{dku}", SPIFFS.exists(FILE_MQTT_KEY) ? "none" : "");
html.replace("{dkf}", SPIFFS.exists(FILE_MQTT_KEY) ? "" : "none");
SPIFFS.end();
} else {
html.replace("${display.ca.upload}", "");
html.replace("${display.ca.file}", "none");
html.replace("${display.cert.upload}", "");
html.replace("${display.cert.file}", "none");
html.replace("${display.key.upload}", "");
html.replace("${display.key.file}", "none");
html.replace("{dcu}", "");
html.replace("{dcf}", "none");
html.replace("{deu}", "");
html.replace("{def}", "none");
html.replace("{dku}", "");
html.replace("{dkf}", "none");
}
server.setContentLength(html.length() + HEAD_HTML_LEN + FOOT_HTML_LEN);
@ -485,26 +487,26 @@ void AmsWebServer::configMqttHtml() {
}
void AmsWebServer::configDomoticzHtml() {
printD("Serving /config/domoticz.html over http...");
printD("Serving /domoticz.html over http...");
if(!checkSecurity(1))
return;
String html = String((const __FlashStringHelper*) CONFIGDOMOTICZ_HTML);
String html = String((const __FlashStringHelper*) DOMOTICZ_HTML);
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
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()));
} else { html.replace("${config.domoVL1IDX}", ""); }
if(config->getDomoVL2IDX() > 0){ html.replace("${config.domoVL2IDX}", String(config->getDomoVL2IDX()));
} else { html.replace("${config.domoVL2IDX}", ""); }
if(config->getDomoVL3IDX() > 0){ html.replace("${config.domoVL3IDX}", String(config->getDomoVL3IDX()));
} else { html.replace("${config.domoVL3IDX}", ""); }
if(config->getDomoCL1IDX() > 0){ html.replace("${config.domoCL1IDX}", String(config->getDomoCL1IDX()));
} else { html.replace("${config.domoCL1IDX}", ""); }
if(config->getDomoELIDX() > 0){ html.replace("{elidx}", String(config->getDomoELIDX()));
} else { html.replace("{elidx}", ""); }
if(config->getDomoVL1IDX() > 0){ html.replace("{vl1idx}", String(config->getDomoVL1IDX()));
} else { html.replace("{vl1idx}", ""); }
if(config->getDomoVL2IDX() > 0){ html.replace("{vl2idx}", String(config->getDomoVL2IDX()));
} else { html.replace("{vl2idx}", ""); }
if(config->getDomoVL3IDX() > 0){ html.replace("{vl3idx}", String(config->getDomoVL3IDX()));
} else { html.replace("{vl3idx}", ""); }
if(config->getDomoCL1IDX() > 0){ html.replace("{cl1idx}", String(config->getDomoCL1IDX()));
} else { html.replace("{cl1idx}", ""); }
server.setContentLength(html.length() + HEAD_HTML_LEN + FOOT_HTML_LEN);
server.send_P(200, "text/html", HEAD_HTML);
@ -513,34 +515,34 @@ void AmsWebServer::configDomoticzHtml() {
}
void AmsWebServer::configEntsoeHtml() {
printD("Serving /config-entsoe.html over http...");
printD("Serving /entsoe.html over http...");
if(!checkSecurity(1))
return;
String html = String((const __FlashStringHelper*) ENTSOE_HTML);
html.replace("${config.entsoeApiToken}", config->getEntsoeApiToken());
html.replace("${config.entsoeApiMultiplier}", String(config->getEntsoeApiMultiplier(), 3));
html.replace("{et}", config->getEntsoeApiToken());
html.replace("{em}", String(config->getEntsoeApiMultiplier(), 3));
html.replace("${config.entsoeApiAreaNo1}", strcmp(config->getEntsoeApiArea(), "10YNO-1--------2") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaNo2}", strcmp(config->getEntsoeApiArea(), "10YNO-2--------T") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaNo3}", strcmp(config->getEntsoeApiArea(), "10YNO-3--------J") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaNo4}", strcmp(config->getEntsoeApiArea(), "10YNO-4--------9") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaNo5}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A48H") == 0 ? "selected" : "");
html.replace("{eaNo1}", strcmp(config->getEntsoeApiArea(), "10YNO-1--------2") == 0 ? "selected" : "");
html.replace("{eaNo2}", strcmp(config->getEntsoeApiArea(), "10YNO-2--------T") == 0 ? "selected" : "");
html.replace("{eaNo3}", strcmp(config->getEntsoeApiArea(), "10YNO-3--------J") == 0 ? "selected" : "");
html.replace("{eaNo4}", strcmp(config->getEntsoeApiArea(), "10YNO-4--------9") == 0 ? "selected" : "");
html.replace("{eaNo5}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A48H") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaSe1}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A44P") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaSe2}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A45N") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaSe3}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A46L") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaSe4}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A47J") == 0 ? "selected" : "");
html.replace("{eaSe1}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A44P") == 0 ? "selected" : "");
html.replace("{eaSe2}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A45N") == 0 ? "selected" : "");
html.replace("{eaSe3}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A46L") == 0 ? "selected" : "");
html.replace("{eaSe4}", strcmp(config->getEntsoeApiArea(), "10Y1001A1001A47J") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaDk1}", strcmp(config->getEntsoeApiArea(), "10YDK-1--------W") == 0 ? "selected" : "");
html.replace("${config.entsoeApiAreaDk2}", strcmp(config->getEntsoeApiArea(), "10YDK-2--------M") == 0 ? "selected" : "");
html.replace("{eaDk1}", strcmp(config->getEntsoeApiArea(), "10YDK-1--------W") == 0 ? "selected" : "");
html.replace("{eaDk2}", strcmp(config->getEntsoeApiArea(), "10YDK-2--------M") == 0 ? "selected" : "");
html.replace("${config.entsoeApiCurrencyNOK}", strcmp(config->getEntsoeApiArea(), "NOK") == 0 ? "selected" : "");
html.replace("${config.entsoeApiCurrencySEK}", strcmp(config->getEntsoeApiArea(), "SEK") == 0 ? "selected" : "");
html.replace("${config.entsoeApiCurrencyDKK}", strcmp(config->getEntsoeApiArea(), "DKK") == 0 ? "selected" : "");
html.replace("${config.entsoeApiCurrencyEUR}", strcmp(config->getEntsoeApiArea(), "EUR") == 0 ? "selected" : "");
html.replace("{ecNOK}", strcmp(config->getEntsoeApiArea(), "NOK") == 0 ? "selected" : "");
html.replace("{ecSEK}", strcmp(config->getEntsoeApiArea(), "SEK") == 0 ? "selected" : "");
html.replace("{ecDKK}", strcmp(config->getEntsoeApiArea(), "DKK") == 0 ? "selected" : "");
html.replace("{ecEUR}", strcmp(config->getEntsoeApiArea(), "EUR") == 0 ? "selected" : "");
server.setContentLength(html.length() + HEAD_HTML_LEN + FOOT_HTML_LEN);
server.send_P(200, "text/html", HEAD_HTML);
@ -549,22 +551,22 @@ void AmsWebServer::configEntsoeHtml() {
}
void AmsWebServer::configWebHtml() {
printD("Serving /config-web.html over http...");
printD("Serving /web.html over http...");
if(!checkSecurity(1))
return;
String html = String((const __FlashStringHelper*) CONFIGWEB_HTML);
String html = String((const __FlashStringHelper*) WEB_HTML);
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
html.replace("${config.authSecurity}", String(config->getAuthSecurity()));
html.replace("{as}", String(config->getAuthSecurity()));
for(int i = 0; i<3; i++) {
html.replace("${config.authSecurity" + String(i) + "}", config->getAuthSecurity() == i ? "selected" : "");
html.replace("{as" + String(i) + "}", config->getAuthSecurity() == i ? "selected" : "");
}
html.replace("${config.authUser}", config->getAuthUser());
html.replace("${config.authPassword}", config->getAuthPassword());
html.replace("{au}", config->getAuthUser());
html.replace("{ap}", config->getAuthPassword());
server.setContentLength(html.length() + HEAD_HTML_LEN + FOOT_HTML_LEN);
server.send_P(200, "text/html", HEAD_HTML);
@ -875,15 +877,15 @@ void AmsWebServer::handleSave() {
String temp;
if(server.hasArg("meterConfig") && server.arg("meterConfig") == "true") {
config->setMeterType(server.arg("meterType").toInt());
config->setDistributionSystem(server.arg("distributionSystem").toInt());
config->setMainFuse(server.arg("mainFuse").toInt());
config->setProductionCapacity(server.arg("productionCapacity").toInt());
config->setSubstituteMissing(server.hasArg("substituteMissing") && server.arg("substituteMissing") == "true");
config->setSendUnknown(server.hasArg("sendUnknown") && server.arg("sendUnknown") == "true");
if(server.hasArg("mc") && server.arg("mc") == "true") {
config->setMeterType(server.arg("m").toInt());
config->setDistributionSystem(server.arg("d").toInt());
config->setMainFuse(server.arg("f").toInt());
config->setProductionCapacity(server.arg("p").toInt());
config->setSubstituteMissing(server.hasArg("s") && server.arg("substituteMissing") == "true");
config->setSendUnknown(server.hasArg("u") && server.arg("sendUnknown") == "true");
String encryptionKeyHex = server.arg("meterEncryptionKey");
String encryptionKeyHex = server.arg("e");
if(!encryptionKeyHex.isEmpty()) {
encryptionKeyHex.replace("0x", "");
uint8_t hexStr[16];
@ -891,7 +893,7 @@ void AmsWebServer::handleSave() {
config->setMeterEncryptionKey(hexStr);
}
String authenticationKeyHex = server.arg("meterAuthenticationKey");
String authenticationKeyHex = server.arg("a");
if(!authenticationKeyHex.isEmpty()) {
authenticationKeyHex.replace("0x", "");
uint8_t hexStr[16];
@ -900,54 +902,54 @@ void AmsWebServer::handleSave() {
}
}
if(server.hasArg("wifiConfig") && server.arg("wifiConfig") == "true") {
config->setWifiSsid(server.arg("wifiSsid").c_str());
config->setWifiPassword(server.arg("wifiPassword").c_str());
if(server.hasArg("wifiIpType") && server.arg("wifiIpType").toInt() == 1) {
config->setWifiIp(server.arg("wifiIp").c_str());
config->setWifiGw(server.arg("wifiGw").c_str());
config->setWifiSubnet(server.arg("wifiSubnet").c_str());
config->setWifiDns1(server.arg("wifiDns1").c_str());
config->setWifiDns2(server.arg("wifiDns2").c_str());
if(server.hasArg("wc") && server.arg("wc") == "true") {
config->setWifiSsid(server.arg("s").c_str());
config->setWifiPassword(server.arg("p").c_str());
if(server.hasArg("st") && server.arg("st").toInt() == 1) {
config->setWifiIp(server.arg("i").c_str());
config->setWifiGw(server.arg("g").c_str());
config->setWifiSubnet(server.arg("sn").c_str());
config->setWifiDns1(server.arg("d1").c_str());
config->setWifiDns2(server.arg("d2").c_str());
} else {
config->clearWifiIp();
}
config->setWifiHostname(server.arg("wifiHostname").c_str());
config->setMdnsEnable(server.hasArg("mDnsEnable") && server.arg("mDnsEnable") == "true");
config->setWifiHostname(server.arg("h").c_str());
config->setMdnsEnable(server.hasArg("m") && server.arg("m") == "true");
}
if(server.hasArg("mqttConfig") && server.arg("mqttConfig") == "true") {
if(server.hasArg("mqtt") && server.arg("mqtt") == "true") {
config->setMqttHost(server.arg("mqttHost").c_str());
int port = server.arg("mqttPort").toInt();
if(server.hasArg("mqc") && server.arg("mqc") == "true") {
if(server.hasArg("m") && server.arg("m") == "true") {
config->setMqttHost(server.arg("h").c_str());
int port = server.arg("p").toInt();
config->setMqttPort(port == 0 ? 1883 : port);
config->setMqttClientId(server.arg("mqttClientId").c_str());
config->setMqttPublishTopic(server.arg("mqttPublishTopic").c_str());
config->setMqttSubscribeTopic(server.arg("mqttSubscribeTopic").c_str());
config->setMqttUser(server.arg("mqttUser").c_str());
config->setMqttPassword(server.arg("mqttPassword").c_str());
config->setMqttPayloadFormat(server.arg("mqttPayloadFormat").toInt());
config->setMqttSsl(server.arg("mqttSsl") == "true");
config->setMqttClientId(server.arg("i").c_str());
config->setMqttPublishTopic(server.arg("t").c_str());
config->setMqttSubscribeTopic(server.arg("st").c_str());
config->setMqttUser(server.arg("u").c_str());
config->setMqttPassword(server.arg("pw").c_str());
config->setMqttPayloadFormat(server.arg("f").toInt());
config->setMqttSsl(server.arg("s") == "true");
} else {
config->clearMqtt();
}
}
if(server.hasArg("domoConfig") && server.arg("domoConfig") == "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());
if(server.hasArg("dc") && server.arg("dc") == "true") {
config->setDomoELIDX(server.arg("elidx").toInt());
config->setDomoVL1IDX(server.arg("vl1idx").toInt());
config->setDomoVL2IDX(server.arg("vl2idx").toInt());
config->setDomoVL3IDX(server.arg("vl3idx").toInt());
config->setDomoCL1IDX(server.arg("cl1idx").toInt());
}
if(server.hasArg("authConfig") && server.arg("authConfig") == "true") {
config->setAuthSecurity((byte)server.arg("authSecurity").toInt());
if(server.hasArg("ac") && server.arg("ac") == "true") {
config->setAuthSecurity((byte)server.arg("as").toInt());
if(config->getAuthSecurity() > 0) {
config->setAuthUser(server.arg("authUser").c_str());
config->setAuthPassword(server.arg("authPassword").c_str());
config->setAuthUser(server.arg("au").c_str());
config->setAuthPassword(server.arg("ap").c_str());
debugger->setPassword(config->getAuthPassword());
} else {
debugger->setPassword("");
@ -1000,14 +1002,14 @@ void AmsWebServer::handleSave() {
}
}
if(server.hasArg("ntpConfig") && server.arg("ntpConfig") == "true") {
config->setNtpEnable(server.hasArg("ntpEnable") && server.arg("ntpEnable") == "true");
config->setNtpDhcp(server.hasArg("ntpDhcp") && server.arg("ntpDhcp") == "true");
if(server.hasArg("ntpOffset") && !server.arg("ntpOffset").isEmpty()) {
int offset = server.arg("ntpOffset").toInt();
if(server.hasArg("nc") && server.arg("nc") == "true") {
config->setNtpEnable(server.hasArg("n") && server.arg("n") == "true");
config->setNtpDhcp(server.hasArg("nd") && server.arg("nd") == "true");
if(server.hasArg("o") && !server.arg("o").isEmpty()) {
int offset = server.arg("o").toInt();
config->setNtpOffset(offset);
if(server.hasArg("ntpSummerOffset") && !server.arg("ntpSummerOffset").isEmpty()) {
int summerOffset = server.arg("ntpSummerOffset").toInt();
if(server.hasArg("so") && !server.arg("so").isEmpty()) {
int summerOffset = server.arg("so").toInt();
config->setNtpSummerOffset(summerOffset);
} else {
config->setNtpSummerOffset(0);
@ -1015,14 +1017,14 @@ void AmsWebServer::handleSave() {
} else {
config->setNtpOffset(0);
}
config->setNtpServer(server.arg("ntpServer").c_str());
config->setNtpServer(server.arg("ns").c_str());
}
if(server.hasArg("entsoeConfig") && server.arg("entsoeConfig") == "true") {
config->setEntsoeApiToken(server.arg("entsoeApiToken").c_str());
config->setEntsoeApiArea(server.arg("entsoeApiArea").c_str());
config->setEntsoeApiCurrency(server.arg("entsoeApiCurrency").c_str());
config->setEntsoeApiMultiplier(server.arg("entsoeApiMultiplier").toDouble());
if(server.hasArg("ec") && server.arg("ec") == "true") {
config->setEntsoeApiToken(server.arg("et").c_str());
config->setEntsoeApiArea(server.arg("ea").c_str());
config->setEntsoeApiCurrency(server.arg("ec").c_str());
config->setEntsoeApiMultiplier(server.arg("em").toDouble());
}
printI("Saving configuration now...");
@ -1066,18 +1068,18 @@ void AmsWebServer::configNtpHtml() {
String html = String((const __FlashStringHelper*) NTP_HTML);
html.replace("${config.ntpEnable}", config->isNtpEnable() ? "checked" : "");
html.replace("{n}", config->isNtpEnable() ? "checked" : "");
for(int i = (3600*-13); i<(3600*15); i+=3600) {
html.replace("${config.ntpOffset" + String(i) + "}", config->getNtpOffset() == i ? "selected" : "");
html.replace("{o" + String(i) + "}", config->getNtpOffset() == i ? "selected" : "");
}
for(int i = 0; i<(3600*3); i+=3600) {
html.replace("${config.ntpSummerOffset" + String(i) + "}", config->getNtpSummerOffset() == i ? "selected" : "");
html.replace("{so" + String(i) + "}", config->getNtpSummerOffset() == i ? "selected" : "");
}
html.replace("${config.ntpServer}", config->getNtpServer());
html.replace("${config.ntpDhcp}", config->isNtpDhcp() ? "checked" : "");
html.replace("{ns}", config->getNtpServer());
html.replace("{nd}", config->isNtpDhcp() ? "checked" : "");
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
@ -1604,8 +1606,12 @@ void AmsWebServer::factoryResetPost() {
void AmsWebServer::notFound() {
server.sendHeader("Location","/");
server.send(303);
server.sendHeader("Cache-Control", "public, max-age=3600");
server.setContentLength(NOTFOUND_HTML_LEN + HEAD_HTML_LEN + FOOT_HTML_LEN);
server.send_P(404, "text/html", HEAD_HTML);
server.sendContent_P(NOTFOUND_HTML);
server.sendContent_P(FOOT_HTML);
}

View File

@ -1,7 +1,7 @@
var nextVersion;
var im, em, vm, am;
$(function() {
im = $("#importMeter");
im = $("#im");
if(im && im.gaugeMeter) {
im.gaugeMeter({
percent: 0,
@ -10,7 +10,7 @@ $(function() {
});
}
em = $("#exportMeter");
em = $("#em");
if(em && em.gaugeMeter) {
em.gaugeMeter({
percent: 0,
@ -19,7 +19,7 @@ $(function() {
});
}
vm = $("#voltMeter");
vm = $("#vm");
if(vm && vm.gaugeMeter) {
vm.gaugeMeter({
percent: 0,
@ -28,7 +28,7 @@ $(function() {
});
}
am = $("#ampMeter");
am = $("#am");
if(am && am.gaugeMeter) {
am.gaugeMeter({
percent: 0,
@ -43,23 +43,23 @@ $(function() {
fetch();
}
// For config-mqtt
$('#mqttEnable').on('change', function() {
var inputs = $('.mqtt-config');
// For mqtt
$('#m').on('change', function() {
var inputs = $('.mc');
inputs.prop('disabled', !$(this).is(':checked'));
});
$('#mqttPayloadFormat').on('change', function() {
$('#f').on('change', function() {
var val = parseInt($(this).val());
if(val == 3) {
$('.format-type-domoticz').show();
$('.f3-s').show();
} else {
$('.format-type-domoticz').hide();
$('.f3-s').hide();
}
});
$('#mqttSsl').on('change', function() {
var port = $('#mqttPort');
$('#s').on('change', function() {
var port = $('#p');
if($(this).is(':checked')) {
if(port.val() == 1883) {
port.val(8883);
@ -71,45 +71,45 @@ $(function() {
}
});
$('#mqttEnable').trigger('change');
$('#mqttPayloadFormat').trigger('change');
$('#m').trigger('change');
$('#f').trigger('change');
// For config-meter
$('.subtitute-dependent').on('change', function() {
if(($('#meterType').val() == 2 || $('#meterType').val() == 3) && $('#distributionSystem').val() == 1) {
$('#substitute').show();
// For meter
$('.sd').on('change', function() {
if(($('#mt').val() == 2 || $('#mt').val() == 3) && $('#d').val() == 1) {
$('#ss').show();
} else {
$('#substitute').hide();
$('#ss').hide();
}
});
$('#meterType').on('change', function() {
if($('#meterType').val() == 4) {
$('.encryption').show();
$('#mt').on('change', function() {
if($('#mt').val() == 4) {
$('.enc').show();
} else {
$('.encryption').hide();
$('.enc').hide();
}
});
$('#meterType').trigger('change');
$('#mt').trigger('change');
// For config-wifi
$('#wifiIpType').on('change', function() {
// For wifi
$('#st').on('change', function() {
if($(this).is(':checked')) {
$('#staticIp').show();
$('#i').show();
} else {
$('#staticIp').hide();
$('#i').hide();
}
});
$('#wifiIpType').trigger('change');
$('#st').trigger('change');
// For config-web
$('#authSecurity').on('change', function() {
var inputs = $('.auth-config');
// For web
$('#as').on('change', function() {
var inputs = $('.ac');
inputs.prop('disabled', $(this).val() == 0);
});
$('#authSecurity').trigger('change');
$('#as').trigger('change');
// For file upload
$('#fileUploadField').on('change',function(){
@ -118,28 +118,28 @@ $(function() {
})
// For NTP
$('#ntpEnable').on('change', function() {
var inputs = $('.ntp-config');
$('#n').on('change', function() {
var inputs = $('.nc');
inputs.prop('disabled', !$(this).is(':checked'));
});
$('#ntpEnable').trigger('change');
$('#n').trigger('change');
// Navbar
switch(window.location.pathname) {
case '/temperature':
$('#config-temp-link').addClass('active');
$('#temp-link').addClass('active');
break;
case '/price':
$('#config-price-link').addClass('active');
$('#price-link').addClass('active');
break;
case '/config-meter':
case '/config-wifi':
case '/config-mqtt':
case '/meter':
case '/wifi':
case '/mqtt':
case '/mqtt-ca':
case '/mqtt-cert':
case '/mqtt-key':
case '/config-domoticz':
case '/config-web':
case '/domoticz':
case '/web':
case '/ntp':
case '/entsoe':
$('#config-link').addClass('active');
@ -257,8 +257,8 @@ var fetch = function() {
}
if(window.moment) {
$('.currentSeconds').html(moment.duration(parseInt(json.uptime_seconds), 'seconds').humanize());
$('.currentSeconds').closest('.row').show();
$('.cs').html(moment.duration(parseInt(json.uptime_seconds), 'seconds').humanize());
$('.cs').closest('.row').show();
}
if(json.status) {
@ -268,9 +268,9 @@ var fetch = function() {
}
if(json.mqtt) {
$('.mqtt-error').addClass('d-none');
$('.mqtt-error'+json.mqtt.lastError).removeClass('d-none');
$('#mqtt-lastError').html(json.mqtt.lastError);
$('.me').addClass('d-none');
$('.me'+json.mqtt.lastError).removeClass('d-none');
$('#ml').html(json.mqtt.lastError);
}
if(json.wifi) {

View File

@ -1,18 +1,18 @@
<form method="post" action="/save">
<input type="hidden" name="domoConfig" value="true"/>
<input type="hidden" name="dc" value="true"/>
<div class="my-3 p-3 bg-white rounded shadow">
<div class="d-flex flex-row flex-wrap">
<div class="m-2 input-group input-group-sm" style="width: 200px;">
<div class="input-group-prepend">
<span class="input-group-text">Electricity IDX</span>
</div>
<input type="number" class="form-control" name="domoELIDX" value="${config.domoELIDX}" min="0" max="65535"/>
<input type="number" class="form-control" name="elidx" value="{elidx}" min="0" max="65535"/>
</div>
<div class="m-2 input-group input-group-sm" style="width: 240px;">
<div class="input-group-prepend">
<span class="input-group-text">Current (3 Phase) IDX</span>
</div>
<input type="number" class="form-control" name="domoCL1IDX" value="${config.domoCL1IDX}" min="0" max="65535"/>
<input type="number" class="form-control" name="cl1idx" value="{cl1idx}" min="0" max="65535"/>
</div>
</div>
<div class="d-flex flex-row flex-wrap">
@ -20,19 +20,19 @@
<div class="input-group-prepend">
<span class="input-group-text">Voltage L1 IDX</span>
</div>
<input type="number" class="form-control" name="domoVL1IDX" value="${config.domoVL1IDX}" min="0" max="65535"/>
<input type="number" class="form-control" name="vl1idx" value="{vl1idx}" min="0" max="65535"/>
</div>
<div class="m-2 input-group input-group-sm" style="width: 200px;">
<div class="input-group-prepend">
<span class="input-group-text">Voltage L1 IDX</span>
</div>
<input type="number" class="form-control" name="domoVL2IDX" value="${config.domoVL2IDX}" min="0" max="65535"/>
<input type="number" class="form-control" name="vl2idx" value="{vl2idx}" min="0" max="65535"/>
</div>
<div class="m-2 input-group input-group-sm" style="width: 200px;">
<div class="input-group-prepend">
<span class="input-group-text">Voltage L1 IDX</span>
</div>
<input type="number" class="form-control" name="domoVL3IDX" value="${config.domoVL3IDX}" min="0" max="65535"/>
<input type="number" class="form-control" name="vl3idx" value="{vl3idx}" min="0" max="65535"/>
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<form method="post" action="/save">
<input type="hidden" name="entsoeConfig" value="true"/>
<input type="hidden" name="ec" value="true"/>
<div class="my-3 p-3 bg-white rounded shadow">
<h6>ENTSO-E API</h6>
<div class="row">
@ -8,7 +8,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Token</span>
</div>
<input type="text" name="entsoeApiToken" class="form-control" value="${config.entsoeApiToken}"/>
<input type="text" name="et" class="form-control" value="{et}"/>
</div>
</div>
<div class="col-xl-2 col-lg-3 col-md-4 col-sm-6">
@ -16,23 +16,23 @@
<div class="input-group-prepend">
<span class="input-group-text">Region</span>
</div>
<select name="entsoeApiArea" class="form-control">
<select name="ea" class="form-control">
<optgroup label="Norway">
<option value="10YNO-1--------2" ${config.entsoeApiAreaNo1}>NO1</option>
<option value="10YNO-2--------T" ${config.entsoeApiAreaNo2}>NO2</option>
<option value="10YNO-3--------J" ${config.entsoeApiAreaNo3}>NO3</option>
<option value="10YNO-4--------9" ${config.entsoeApiAreaNo4}>NO4</option>
<option value="10Y1001A1001A48H" ${config.entsoeApiAreaNo5}>NO5</option>
<option value="10YNO-1--------2" {eaNo1}>NO1</option>
<option value="10YNO-2--------T" {eaNo1}>NO2</option>
<option value="10YNO-3--------J" {eaNo3}>NO3</option>
<option value="10YNO-4--------9" {eaNo4}>NO4</option>
<option value="10Y1001A1001A48H" {eaNo5}>NO5</option>
</optgroup>
<optgroup label="Sweden">
<option value="10Y1001A1001A44P" ${config.entsoeApiAreaSe1}>SE1</option>
<option value="10Y1001A1001A45N" ${config.entsoeApiAreaSe2}>SE2</option>
<option value="10Y1001A1001A46L" ${config.entsoeApiAreaSe3}>SE3</option>
<option value="10Y1001A1001A47J" ${config.entsoeApiAreaSe4}>SE4</option>
<option value="10Y1001A1001A44P" {eaSe1}>SE1</option>
<option value="10Y1001A1001A45N" {eaSe2}>SE2</option>
<option value="10Y1001A1001A46L" {eaSe3}>SE3</option>
<option value="10Y1001A1001A47J" {eaSe4}>SE4</option>
</optgroup>
<optgroup label="Denmark">
<option value="10YDK-1--------W" ${config.entsoeApiAreaDk1}>DK1</option>
<option value="10YDK-2--------M" ${config.entsoeApiAreaDk2}>DK2</option>
<option value="10YDK-1--------W" {eaDk1}>DK1</option>
<option value="10YDK-2--------M" {eaDk2}>DK2</option>
</optgroup>
</select>
</div>
@ -42,11 +42,11 @@
<div class="input-group-prepend">
<span class="input-group-text">Currency</span>
</div>
<select name="entsoeApiCurrency" class="form-control">
<option value="NOK" ${config.entsoeApiCurrencyNOK}>NOK</option>
<option value="SEK" ${config.entsoeApiCurrencySEK}>SEK</option>
<option value="DKK" ${config.entsoeApiCurrencyDKK}>DKK</option>
<option value="EUR" ${config.entsoeApiCurrencyEUR}>EUR</option>
<select name="ec" class="form-control">
<option value="NOK" {ecNOK}>NOK</option>
<option value="SEK" {ecSEK}>SEK</option>
<option value="DKK" {ecDKK}>DKK</option>
<option value="EUR" {ecEUR}>EUR</option>
</select>
</div>
</div>
@ -55,7 +55,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Multiplier</span>
</div>
<input name="entsoeApiMultiplier" type="number" min="0.001" max="1000" step="0.001" class="form-control" value="${config.entsoeApiMultiplier}"/>
<input name="em" type="number" min="0.001" max="1000" step="0.001" class="form-control" value="{em}"/>
</div>
</div>
</div>

View File

@ -45,19 +45,27 @@
font-weight: 200;
opacity: .8;
}
.navbar-expand .navbar-nav .nav-link,.navbar-brand {
padding-top: 0px;
padding-bottom: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
</style>
</head>
<body class="bg-light">
<main role="main" class="container">
<header class="navbar navbar-expand navbar-dark flex-column flex-lg-row rounded mt-2 mb-3" style="background-color: var(--purple);">
<a href="/" class=""><h6 class="navbar-brand">AMS reader <small id="swVersion" data-url="https://api.github.com/repos/gskjold/AmsToMqttBridge/releases">${version}</small></h6></a>
<a href="/" class="">
<h6 class="navbar-brand">AMS reader <small id="swVersion" data-url="https://api.github.com/repos/gskjold/AmsToMqttBridge/releases">${version}</small></h6>
</a>
<div class="navbar-nav-scroll">
<ul class="navbar-nav bd-navbar-nav flex-row">
<li class="nav-item">
<a id="config-temp-link" class="nav-link" href="/temperature">Temp<span class="d-none d-sm-inline">erature</span></a>
<a id="temp-link" class="nav-link" href="/temperature">Temp<span class="d-none d-sm-inline">erature</span></a>
</li>
<li class="nav-item">
<a id="config-price-link" class="nav-link" href="/price"><span class="d-none d-sm-inline">Energy</span> Price</a>
<a id="price-link" class="nav-link" href="/price"><span class="d-none d-sm-inline">Energy</span> Price</a>
</li>
<li class="nav-item">
<div class="dropdown">
@ -66,10 +74,10 @@
</a>
<div class="dropdown-menu" aria-labelledby="config-link">
<a class="dropdown-item" href="/config-meter">Meter</a>
<a class="dropdown-item" href="/config-wifi">WiFi</a>
<a class="dropdown-item" href="/config-mqtt">MQTT</a>
<a class="dropdown-item" href="/config-web">Web</a>
<a class="dropdown-item" href="/meter">Meter</a>
<a class="dropdown-item" href="/wifi">WiFi</a>
<a class="dropdown-item" href="/mqtt">MQTT</a>
<a class="dropdown-item" href="/web">Web</a>
<a class="dropdown-item" href="/ntp">NTP</a>
<a class="dropdown-item" href="/entsoe">ENTSO-E API</a>
<div class="dropdown-divider"></div>

View File

@ -1,16 +1,16 @@
<div class="bg-white rounded shadow p-1">
<div class="row">
<div class="col-md-3 col-6">
<div class="text-center">Up <span class="currentSeconds">${currentSeconds}</span></div>
<div class="text-center">Up <span class="cs">{cs}</span></div>
</div>
<div class="col-md-3 col-6">
<div class="text-center">Temperature: <span class="temp">${temp}</span>&deg;C</div>
<div class="text-center">Temperature: <span class="temp">{temp}</span>&deg;C</div>
</div>
<div class="col-md-3 col-6">
<div class="text-center">ESP volt: <span class="vcc">${vcc}</span>V</div>
<div class="text-center">ESP volt: <span class="vcc">{vcc}</span>V</div>
</div>
<div class="col-md-3 col-6">
<div class="text-center">WiFi RSSI: <span class="rssi">${wifi.rssi}</span>dBm</div>
<div class="text-center">WiFi RSSI: <span class="rssi">{rssi}</span>dBm</div>
</div>
</div>
</div>
@ -22,9 +22,9 @@
<div class="bg-white rounded shadow p-3">
<div class="text-center">
<div id="P" class="SimpleMeter" style="display: inline;">
${data.P} W
{P} W
</div>
<div id="importMeter" class="GaugeMeter rounded"
<div id="im" class="GaugeMeter rounded"
style="display: none;"
data-size="180px"
data-text_size="0.15"
@ -32,21 +32,21 @@
data-style="Arch"
data-theme="Green-Gold-Red"
data-animationstep="0"
data-label="${text.import}"
data-label="{ti}"
></div>
</div>
<div id="tPI-row" class="row" style="display: ${display.accumulative};">
<div class="col-12 text-right"><span class="tPI">${data.tPI}</span> kWh</div>
<div id="tPI-row" class="row" style="display: {da};">
<div class="col-12 text-right"><span class="tPI">{tPI}</span> kWh</div>
</div>
</div>
</div>
<div class="col-sm-6 mt-3" style="display: ${display.export};">
<div class="col-sm-6 mt-3" style="display: {de};">
<div class="bg-white rounded shadow p-3">
<div class="text-center">
<div id="P" class="SimpleMeter" style="display: inline;">
${data.PO} W
{PO} W
</div>
<div id="exportMeter" class="GaugeMeter rounded"
<div id="em" class="GaugeMeter rounded"
style="display: none;"
data-size="180px"
data-text_size="0.15"
@ -57,29 +57,29 @@
data-label="Export"
></div>
</div>
<div id="tPO-row" class="row" style="display: ${display.accumulative};">
<div class="col-12 text-right"><span class="tPO">${data.tPO}</span> kWh</div>
<div id="tPO-row" class="row" style="display: {da};">
<div class="col-12 text-right"><span class="tPO">{tPO}</span> kWh</div>
</div>
</div>
</div>
<div class="col-sm-6 mt-3" style="display: ${display.nonexport};">
<div class="bg-white rounded shadow p-3" style="display: ${display.accumulative};">
<div class="col-sm-6 mt-3" style="display: {dn};">
<div class="bg-white rounded shadow p-3" style="display: {da};">
<h5 class="text-center">Reactive</h5>
<div id="tQI-row" class="row">
<div class="col-4">Import</div>
<div class="col-8 text-right"><span class="tQI">${data.tQI}</span> kvarh</div>
<div class="col-8 text-right"><span class="tQI">{tQI}</span> kvarh</div>
<div class="col-4">Export</div>
<div class="col-8 text-right"><span class="tQO">${data.tQO}</span> kvarh</div>
<div class="col-8 text-right"><span class="tQO">{tQO}</span> kvarh</div>
</div>
</div>
</div>
<div class="col-sm-12 mt-3" style="display: ${display.export};">
<div class="bg-white rounded shadow p-3" style="display: ${display.accumulative};">
<div class="col-sm-12 mt-3" style="display: {de};">
<div class="bg-white rounded shadow p-3" style="display: {da};">
<div id="tQO-row" class="row">
<div class="col-4">Import</div>
<div class="col-8 text-right"><span class="tQI">${data.tQI}</span> kvarh</div>
<div class="col-4">Export</div>
<div class="col-8 text-right"><span class="tQO">${data.tQO}</span> kvarh</div>
<div class="col-4 col-sm-2">Import</div>
<div class="col-8 col-sm-4 text-right"><span class="tQI">{tQI}</span> kvarh</div>
<div class="col-4 col-sm-2">Export</div>
<div class="col-8 col-sm-4 text-right"><span class="tQO">{tQO}</span> kvarh</div>
</div>
</div>
</div>
@ -88,7 +88,7 @@
<div class="col-lg-3 col-sm-6 mt-3">
<div class="bg-white rounded shadow p-3">
<div class="text-center">
<div id="voltMeter" class="GaugeMeter rounded"
<div id="vm" class="GaugeMeter rounded"
style="display: none;"
data-size="180px"
data-text_size="0.15"
@ -99,40 +99,40 @@
data-label="Volt"
></div>
</div>
<div id="U2-row" class="row" style="display: ${display.3p};">
<div class="col-4" title="L1"><span class="U1">${data.U1}</span>V</div>
<div class="col-4 text-center" title="L2"><span class="U2">${data.U2}</span>V</div>
<div class="col-4 text-right" title="L3"><span class="U3">${data.U3}</span>V</div>
<div id="U2-row" class="row" style="display: {3p};">
<div class="col-4"><span class="U1">{U1}</span>V</div>
<div class="col-4 text-center"><span class="U2">{U2}</span>V</div>
<div class="col-4 text-right"><span class="U3">{U3}</span>V</div>
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6 mb-3 mt-3">
<div class="bg-white rounded shadow p-3">
<div class="text-center">
<div id="ampMeter" class="GaugeMeter rounded"
<div id="am" class="GaugeMeter rounded"
style="display: none;"
data-size="180px"
data-text_size="0.15"
data-width="25"
data-style="Arch"
data-theme="Green-Gold-Red"
data-theme="Green-Red"
data-animationstep="0"
data-label="Ampere"
></div>
</div>
<div id="I2-row" class="row" style="display: ${display.3p};">
<div class="col-4" title="L1"><span class="I1">${data.I1}</span>A</div>
<div class="col-4 text-center" title="L2"><span class="I2">${data.I2}</span>A</div>
<div class="col-4 text-right" title="L3"><span class="I3">${data.I3}</span>A</div>
<div id="I2-row" class="row" style="display: {3p};">
<div class="col-4"><span class="I1">{I1}</span>A</div>
<div class="col-4 text-center"><span class="I2">{I2}</span>A</div>
<div class="col-4 text-right"><span class="I3">{I3}</span>A</div>
</div>
</div>
</div>
<div class="col-lg-3 col-sm-6 mb-3 d-none mqtt-error mqtt-error-1 mqtt-error-2 mqtt-error-3 mqtt-error-4 mqtt-error-5 mqtt-error-6 mqtt-error-7 mqtt-error-8 mqtt-error-9 mqtt-error-10 mqtt-error-11 mqtt-error-12 mqtt-error-13">
<div class="d-none badge badge-danger mqtt-error mqtt-error-1 mqtt-error-2 mqtt-error-5 mqtt-error-6 mqtt-error-7 mqtt-error-8 mqtt-error-9 mqtt-error-12">MQTT communication error (<span id="mqtt-lastError">-</span>)</div>
<div class="d-none badge badge-danger mqtt-error mqtt-error-3">MQTT failed to connect</div>
<div class="d-none badge badge-danger mqtt-error mqtt-error-4">MQTT network timeout</div>
<div class="d-none badge badge-danger mqtt-error mqtt-error-10">MQTT connection denied</div>
<div class="d-none badge badge-danger mqtt-error mqtt-error-11">MQTT failed to subscribe</div>
<div class="d-none badge badge-danger mqtt-error mqtt-error-13">MQTT lost connection</div>
<div class="col-lg-3 col-sm-6 mb-3 d-none me me-1 me-2 me-3 me-4 me-5 me-6 me-7 me-8 me-9 me-10 me-11 me-12 me-13">
<div class="d-none badge badge-danger me me-1 me-2 me-5 me-6 me-7 me-8 me-9 me-12">MQTT communication error (<span id="ml">-</span>)</div>
<div class="d-none badge badge-danger me me-3">MQTT failed to connect</div>
<div class="d-none badge badge-danger me me-4">MQTT network timeout</div>
<div class="d-none badge badge-danger me me-10">MQTT connection denied</div>
<div class="d-none badge badge-danger me me-11">MQTT failed to subscribe</div>
<div class="d-none badge badge-danger me me-13">MQTT lost connection</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<form method="post" action="/save">
<input type="hidden" name="meterConfig" value="true"/>
<input type="hidden" name="mc" value="true"/>
<div class="my-3 p-3 bg-white rounded shadow">
<h6>Meter</h6>
<div class="row">
@ -8,12 +8,12 @@
<div class="input-group-prepend">
<span class="input-group-text">Meter type</span>
</div>
<select id="meterType" class="form-control subtitute-dependent" name="meterType">
<option value="0" ${config.meterType0}>Autodetect</option>
<option value="1" ${config.meterType1}>Kaifa</option>
<option value="2" ${config.meterType2}>Aidon</option>
<option value="3" ${config.meterType3}>Kamstrup</option>
<option value="4" ${config.meterType4}>Kamstrup (Omnipower)</option>
<select id="mt" class="form-control sd" name="m">
<option value="0" {m0}>Autodetect</option>
<option value="1" {m1}>Kaifa</option>
<option value="2" {m2}>Aidon</option>
<option value="3" {m3}>Kamstrup</option>
<option value="4" {m4}>Kamstrup (Omnipower)</option>
</select>
</div>
</div>
@ -22,10 +22,10 @@
<div class="input-group-prepend">
<span class="input-group-text">Distribution system</span>
</div>
<select id="distributionSystem" class="form-control subtitute-dependent" name="distributionSystem">
<option value="0" ${config.distributionSystem0}></option>
<option value="1" ${config.distributionSystem1}>IT (230V)</option>
<option value="2" ${config.distributionSystem2}>TN (400V)</option>
<select id="d" class="form-control sd" name="d">
<option value="0" {d0}></option>
<option value="1" {d1}>IT (230V)</option>
<option value="2" {d2}>TN (400V)</option>
</select>
</div>
</div>
@ -34,14 +34,14 @@
<div class="input-group-prepend">
<span class="input-group-text">Main fuse</span>
</div>
<select class="form-control" name="mainFuse">
<option value="0" ${config.mainFuse0}></option>
<option value="25" ${config.mainFuse25}>25A</option>
<option value="32" ${config.mainFuse32}>32A</option>
<option value="35" ${config.mainFuse32}>35A</option>
<option value="40" ${config.mainFuse40}>40A</option>
<option value="50" ${config.mainFuse50}>50A</option>
<option value="63" ${config.mainFuse63}>63A</option>
<select class="form-control" name="f">
<option value="0" {f0}></option>
<option value="25" {f25}>25A</option>
<option value="32" {f32}>32A</option>
<option value="35" {f32}>35A</option>
<option value="40" {f40}>40A</option>
<option value="50" {f50}>50A</option>
<option value="63" {f63}>63A</option>
</select>
</div>
</div>
@ -50,36 +50,36 @@
<div class="input-group-prepend">
<span class="input-group-text">Production capacity</span>
</div>
<input class="form-control" name="productionCapacity" type="number" min="0" max="50" value="${config.productionCapacity}"/>
<input class="form-control" name="p" type="number" min="0" max="50" value="{p}"/>
<div class="input-group-append">
<span class="input-group-text">kWp</span>
</div>
</div>
</div>
<div class="col-lg-6 encryption">
<div class="col-lg-6 enc">
<div class="m-2 input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">Encryption key</span>
</div>
<input class="form-control" name="meterEncryptionKey" type="text" value="${config.meterEncryptionKey}" placeholder="0x00000000000000000000000000000000"/>
<input class="form-control" name="e" type="text" value="{e}"/>
</div>
</div>
<div class="col-lg-6 encryption">
<div class="col-lg-6 enc">
<div class="m-2 input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">Authentication key</span>
</div>
<input class="form-control" name="meterAuthenticationKey" type="text" value="${config.meterAuthenticationKey}" placeholder="0x00000000000000000000000000000000"/>
<input class="form-control" name="a" type="text" value="{a}"/>
</div>
</div>
<div id="substitute" class="col-lg-3 col-md-4 col-sm-5">
<div id="ss" class="col-lg-3 col-md-4 col-sm-5">
<div class="m-2">
<label class="small"><input id="substituteMissing" type="checkbox" name="substituteMissing" value="true" ${config.substituteMissing}/> Substitute missing values</label>
<label class="small"><input type="checkbox" name="s" value="true" {s}/> Substitute missing values</label>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-5">
<div class="m-2">
<label class="small"><input type="checkbox" name="sendUnknown" value="true" ${config.sendUnknown}/> Send unknown packets to MQTT</label>
<label class="small"><input type="checkbox" name="u" value="true" {u}/> Send unknown packets to MQTT</label>
</div>
</div>
</div>

View File

@ -1,15 +1,15 @@
<form method="post" action="/save">
<input type="hidden" name="mqttConfig" value="true"/>
<input type="hidden" name="mqc" value="true"/>
<div class="my-3 p-3 bg-white rounded shadow">
<h6>MQTT</h6>
<label class="m-2"><input id="mqttEnable" type="checkbox" name="mqtt" value="true" ${config.mqtt}/> Enable</label>
<label class="m-2"><input id="m" type="checkbox" name="m" value="true" {m}/> Enable</label>
<div class="row">
<div class="col-xl-4 col-lg-5 col-md-6">
<div class="m-2 input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">Host</span>
</div>
<input type="text" class="form-control mqtt-config" name="mqttHost" value="${config.mqttHost}" maxlength="128"/>
<input type="text" class="form-control mc" name="h" value="{h}" maxlength="128"/>
</div>
</div>
<div class="col-xl-2 col-lg-3 col-md-3 col-sm-4">
@ -17,7 +17,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Port</span>
</div>
<input id="mqttPort" type="number" class="form-control mqtt-config" name="mqttPort" value="${config.mqttPort}" min="1024" max="65535" placeholder="1883"/>
<input id="p" type="number" class="form-control mc" name="p" value="{p}" min="1024" max="65535" placeholder="1883"/>
</div>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 col-sm-8">
@ -25,7 +25,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Client ID</span>
</div>
<input type="text" class="form-control mqtt-config" name="mqttClientId" value="${config.mqttClientId}" maxlength="32"/>
<input type="text" class="form-control mc" name="i" value="{i}" maxlength="32"/>
</div>
</div>
<div class="col-xl-3 col-lg-4 col-md-6">
@ -33,7 +33,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Publish topic</span>
</div>
<input type="text" class="form-control mqtt-config" name="mqttPublishTopic" value="${config.mqttPublishTopic}" maxlength="64"/>
<input type="text" class="form-control mc" name="t" value="{t}" maxlength="64"/>
</div>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 col-sm-6">
@ -41,7 +41,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Username</span>
</div>
<input type="text" class="form-control mqtt-config" name="mqttUser" value="${config.mqttUser}" maxlength="64"/>
<input type="text" class="form-control mc" name="u" value="{u}" maxlength="64"/>
</div>
</div>
<div class="col-xl-3 col-lg-4 col-md-6 col-sm-6">
@ -49,7 +49,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Password</span>
</div>
<input type="password" class="form-control mqtt-config" name="mqttPassword" value="${config.mqttPassword}" maxlength="64"/>
<input type="password" class="form-control mc" name="pw" value="{pw}" maxlength="64"/>
</div>
</div>
<div class="col-lg-3 col-md-4 col-sm-6">
@ -57,17 +57,17 @@
<div class="input-group-prepend">
<span class="input-group-text">Payload</span>
</div>
<select id="mqttPayloadFormat" class="form-control mqtt-config" name="mqttPayloadFormat">
<option value="0" ${config.mqttPayloadFormat0}>JSON</option>
<option value="1" ${config.mqttPayloadFormat1}>Raw (minimal)</option>
<option value="2" ${config.mqttPayloadFormat2}>Raw (full)</option>
<option value="3" ${config.mqttPayloadFormat3}>Domoticz</option>
<select id="f" class="form-control mc" name="f">
<option value="0" {f0}>JSON</option>
<option value="1" {f1}>Raw (minimal)</option>
<option value="2" {f2}>Raw (full)</option>
<option value="3" {f3}>Domoticz</option>
</select>
</div>
</div>
<div class="col-md-3 col-sm-6 format-type-domoticz">
<div class="col-md-3 col-sm-6 f3-s">
<div class="m-2">
<a href="/config-domoticz" class="btn btn-sm btn-outline-secondary">Configuration</a>
<a href="/domoticz" class="btn btn-sm btn-outline-secondary">Configuration</a>
</div>
</div>
</div>
@ -75,7 +75,7 @@
<div class="my-3 p-3 bg-white rounded shadow">
<div class="row">
<div class="col-md-2">
<label class="m-2"><input id="mqttSsl" type="checkbox" name="mqttSsl" value="true" ${config.mqttSsl}/> SSL</label>
<label class="m-2"><input id="s" type="checkbox" name="s" value="true" {s}/> SSL</label>
</div>
<div class="col-lg-2 col-md-3">
<div class="m-2 input-group input-group-sm">
@ -83,10 +83,10 @@
<span class="input-group-text">CA</span>
</div>
<div class="input-group-append">
<span style="display: ${display.ca.upload};">
<span style="display: {dcu};">
<a href="/mqtt-ca" class="btn btn-sm btn-outline-secondary">Upload</a>
</span>
<span style="display: ${display.ca.file};">
<span style="display: {dcf};">
<a href="/mqtt-ca" class="btn btn-sm btn-danger">Delete</a>
</span>
</div>
@ -98,10 +98,10 @@
<span class="input-group-text">Certificate</span>
</div>
<div class="input-group-append">
<span style="display: ${display.cert.upload};">
<span style="display: {deu};">
<a href="/mqtt-cert" class="btn btn-sm btn-outline-secondary">Upload</a>
</span>
<span style="display: ${display.cert.file};">
<span style="display: {def};">
<a href="/mqtt-cert" class="btn btn-sm btn-danger">Delete</a>
</span>
</div>
@ -113,10 +113,10 @@
<span class="input-group-text">Private key</span>
</div>
<div class="input-group-append">
<span style="display: ${display.key.upload};">
<span style="display: {dku};">
<a href="/mqtt-key" class="btn btn-sm btn-outline-secondary">Upload</a>
</span>
<span style="display: ${display.key.file};">
<span style="display: {dkf};">
<a href="/mqtt-key" class="btn btn-sm btn-danger">Delete</a>
</span>
</div>

1
web/notfound.html Normal file
View File

@ -0,0 +1 @@
<div class="alert alert-danger">Page not found</div>

View File

@ -1,18 +1,18 @@
<form method="post" action="/save">
<input type="hidden" name="ntpConfig" value="true"/>
<input type="hidden" name="nc" value="true"/>
<div class="my-3 p-3 bg-white rounded shadow">
<h6>NTP</h6>
<label class="m-2"><input id="ntpEnable" type="checkbox" name="ntpEnable" value="true" ${config.ntpEnable}/> Enable</label>
<label class="m-2"><input id="n" type="checkbox" name="n" value="true" {n}/> Enable</label>
<div class="row">
<div class="col-lg-3 col-md-4 col-sm-5">
<div class="m-2 input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">Timezone</span>
</div>
<select id="ntpOffset" class="form-control ntp-config" name="ntpOffset">
<option value="0" ${config.ntpOffset0}>UTC</option>
<option value="3600" ${config.ntpOffset3600}>UTC+1</option>
<option value="7200" ${config.ntpOffset7200}>UTC+2</option>
<select id="o" class="form-control nc" name="o">
<option value="0" {o0}>UTC</option>
<option value="3600" {o3600}>UTC+1</option>
<option value="7200" {o7200}>UTC+2</option>
</select>
</div>
</div>
@ -21,9 +21,9 @@
<div class="input-group-prepend">
<span class="input-group-text">Summertime offset</span>
</div>
<select id="ntpSummerOffset" class="form-control ntp-config" name="ntpSummerOffset">
<option value="0" ${config.ntpSummerOffset0}>Disabled</option>
<option value="3600" ${config.ntpSummerOffset3600}>+1hr</option>
<select id="so" class="form-control nc" name="so">
<option value="0" {so0}>Disabled</option>
<option value="3600" {so3600}>+1hr</option>
</select>
</div>
</div>
@ -32,12 +32,12 @@
<div class="input-group-prepend">
<span class="input-group-text">Server</span>
</div>
<input type="text" class="form-control ntp-config" name="ntpServer" value="${config.ntpServer}" maxlength="64"/>
<input type="text" class="form-control nc" name="ns" value="{ns}" maxlength="64"/>
</div>
</div>
<div class="col-lg-4 col-md-5 col-sm-6">
<div class="m-2">
<label class="small"><input type="checkbox" name="ntpDhcp" value="true" ${config.ntpDhcp} class="ntp-config"/> Obtain NTP server from DHCP</label>
<label class="small"><input type="checkbox" name="nd" value="true" {nd} class="nc"/> Obtain NTP server from DHCP</label>
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<form method="post" action="/save">
<input type="hidden" name="authConfig" value="true"/>
<input type="hidden" name="ac" value="true"/>
<div class="my-3 p-3 bg-white rounded shadow">
<h6>Web</h6>
<div class="row">
@ -8,10 +8,10 @@
<div class="input-group-prepend">
<span class="input-group-text">Security</span>
</div>
<select id="authSecurity" class="form-control" name="authSecurity">
<option value="0" ${config.authSecurity0}>None</option>
<option value="1" ${config.authSecurity1}>Only configuration</option>
<option value="2" ${config.authSecurity2}>Everything</option>
<select id="as" class="form-control" name="as">
<option value="0" {as0}>None</option>
<option value="1" {as1}>Only configuration</option>
<option value="2" {as2}>Everything</option>
</select>
</div>
</div>
@ -20,7 +20,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Username</span>
</div>
<input type="text" class="form-control auth-config" name="authUser" value="${config.authUser}" maxlength="64"/>
<input type="text" class="form-control ac" name="au" value="{au}" maxlength="64"/>
</div>
</div>
<div class="col-xl-3 col-lg-4 col-md-6">
@ -28,7 +28,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Password</span>
</div>
<input type="password" class="form-control auth-config" name="authPassword" value="${config.authPassword}" maxlength="64"/>
<input type="password" class="form-control ac" name="ap" value="{ap}" maxlength="64"/>
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<form method="post" action="/save">
<input type="hidden" name="wifiConfig" value="true"/>
<input type="hidden" name="wc" value="true"/>
<div class="my-3 p-3 bg-white rounded shadow">
<h6>WiFi</h6>
<div class="row">
@ -8,7 +8,7 @@
<div class="input-group-prepend">
<span class="input-group-text">SSID</span>
</div>
<input type="text" name="wifiSsid" class="form-control" maxlength="32" placeholder="Name of your WiFi" value="${config.wifiSsid}" required/>
<input type="text" name="s" class="form-control" maxlength="32" value="{s}" required/>
</div>
</div>
<div class="col-xl-3 col-md-6 form-group">
@ -16,7 +16,7 @@
<div class="input-group-prepend">
<span class="input-group-text">PSK</span>
</div>
<input type="password" name="wifiPassword" class="form-control" maxlength="63" placeholder="Password for WiFi" value="${config.wifiPassword}" required/>
<input type="password" name="p" class="form-control" maxlength="63" value="{p}" required/>
</div>
</div>
<div class="col-xl-4 col-md-6 form-group">
@ -24,25 +24,25 @@
<div class="input-group-prepend">
<span class="input-group-text">Hostname</span>
</div>
<input type="text" name="wifiHostname" class="form-control" maxlength="32" pattern="[a-z0-9_-]+" placeholder="Optional, ex.: ams-reader" value="${config.wifiHostname}"/>
<div class="input-group-append" title="Enable mDNS">
<input type="text" name="h" class="form-control" maxlength="32" pattern="[a-z0-9_-]+" placeholder="Optional, ex.: ams-reader" value="{h}"/>
<div class="input-group-append">
<label class="input-group-text">
<input type="checkbox" name="mDnsEnable" value="true" ${config.mDnsEnable}/> mDNS
<input type="checkbox" name="m" value="true" {m}/> mDNS
</label>
</div>
</div>
</div>
<div class="col-xl-2 col-md-6 form-group">
<label><input id="wifiIpType" type="checkbox" name="wifiIpType" value="1" ${config.wifiStaticIp}/> Static IP</label>
<label><input id="st" type="checkbox" name="st" value="1" {st}/> Static IP</label>
</div>
</div>
<div class="row" id="staticIp">
<div class="row" id="i">
<div class="col-xl-3 col-lg-4 form-group">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">IP</span>
</div>
<input type="text" name="wifiIp" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" placeholder="Ex: 192.168.1.200" value="${config.wifiIp}"/>
<input type="text" name="i" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" value="{i}"/>
</div>
</div>
<div class="col-xl-3 col-lg-4 form-group">
@ -50,7 +50,7 @@
<div class="input-group-prepend">
<span class="input-group-text">Subnet</span>
</div>
<input type="text" name="wifiSubnet" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" placeholder="Ex.: 255.255.255.0" value="${config.wifiSubnet}"/>
<input type="text" name="sn" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" value="{sn}"/>
</div>
</div>
<div class="col-xl-3 col-lg-4 form-group">
@ -58,23 +58,23 @@
<div class="input-group-prepend">
<span class="input-group-text">Gateway</span>
</div>
<input type="text" name="wifiGw" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" placeholder="Ex.: 192.168.1.1" value="${config.wifiGw}"/>
<input type="text" name="g" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" value="{g}"/>
</div>
</div>
<div class="col-xl-4 col-lg-5 form-group">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">Primary DNS</span>
<span class="input-group-text">DNS 1</span>
</div>
<input type="text" name="wifiDns1" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" placeholder="Ex.: 192.168.1.1" value="${config.wifiDns1}"/>
<input type="text" name="d1" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" value="{d1}"/>
</div>
</div>
<div class="col-xl-4 col-lg-5 form-group">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">Secondary DNS</span>
<span class="input-group-text">DNS 2</span>
</div>
<input type="text" name="wifiDns2" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" placeholder="Ex.: 8.8.8.8" value="${config.wifiDns2}"/>
<input type="text" name="d2" class="form-control" pattern="\d?\d?\d.\d?\d?\d.\d?\d?\d.\d?\d?\d" value="{d2}"/>
</div>
</div>
</div>