mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-04 23:26:17 +00:00
Domoticz: make config save values, cleanup.
This commit is contained in:
@@ -734,33 +734,10 @@ bool AmsConfiguration::loadConfig81(int address) {
|
|||||||
address += readInt(address, &i);
|
address += readInt(address, &i);
|
||||||
setDebugLevel(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();
|
ackWifiChange();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AmsConfiguration::save() {
|
bool AmsConfiguration::save() {
|
||||||
int address = EEPROM_CONFIG_ADDRESS;
|
int address = EEPROM_CONFIG_ADDRESS;
|
||||||
@@ -867,13 +844,13 @@ void AmsConfiguration::print(Print* debugger)
|
|||||||
debugger->printf("Vcc multiplier: %f\r\n", this->getVccMultiplier());
|
debugger->printf("Vcc multiplier: %f\r\n", this->getVccMultiplier());
|
||||||
debugger->printf("Vcc boot limit: %f\r\n", this->getVccBootLimit());
|
debugger->printf("Vcc boot limit: %f\r\n", this->getVccBootLimit());
|
||||||
|
|
||||||
if(this->getDomoELIDX() > 0) {
|
//if(this->getDomoELIDX() > 0) {
|
||||||
debugger->printf("Domoticz ELIDX: %i\r\n", this->getDomoELIDX());
|
debugger->printf("Domoticz ELIDX: %i\r\n", this->getDomoELIDX());
|
||||||
debugger->printf("Domoticz VL1IDX: %i\r\n", this->getDomoVL1IDX());
|
debugger->printf("Domoticz VL1IDX: %i\r\n", this->getDomoVL1IDX());
|
||||||
debugger->printf("Domoticz VL2IDX: %i\r\n", this->getDomoVL2IDX());
|
debugger->printf("Domoticz VL2IDX: %i\r\n", this->getDomoVL2IDX());
|
||||||
debugger->printf("Domoticz VL3IDX: %i\r\n", this->getDomoVL3IDX());
|
debugger->printf("Domoticz VL3IDX: %i\r\n", this->getDomoVL3IDX());
|
||||||
debugger->printf("Domoticz CL1IDX: %i\r\n", this->getDomoCL1IDX());
|
debugger->printf("Domoticz CL1IDX: %i\r\n", this->getDomoCL1IDX());
|
||||||
}
|
//}
|
||||||
|
|
||||||
debugger->println("-----------------------------------------------");
|
debugger->println("-----------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -324,7 +324,6 @@ void AmsWebServer::configDomoticzHtml() {
|
|||||||
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
server.sendHeader("Pragma", "no-cache");
|
server.sendHeader("Pragma", "no-cache");
|
||||||
|
|
||||||
html.replace("${config.domo}", config->getDomoELIDX() <= 0 ? "" : "checked");
|
|
||||||
if(config->getDomoELIDX() > 0){ html.replace("${config.domoELIDX}", String(config->getDomoELIDX()));
|
if(config->getDomoELIDX() > 0){ html.replace("${config.domoELIDX}", String(config->getDomoELIDX()));
|
||||||
} else { html.replace("${config.domoELIDX}", ""); }
|
} else { html.replace("${config.domoELIDX}", ""); }
|
||||||
if(config->getDomoVL1IDX() > 0){ html.replace("${config.domoVL1IDX}", String(config->getDomoVL1IDX()));
|
if(config->getDomoVL1IDX() > 0){ html.replace("${config.domoVL1IDX}", String(config->getDomoVL1IDX()));
|
||||||
@@ -526,6 +525,7 @@ void AmsWebServer::dataJson() {
|
|||||||
json.createNestedObject("mqtt");
|
json.createNestedObject("mqtt");
|
||||||
json["mqtt"]["lastError"] = (int) mqtt->lastError();
|
json["mqtt"]["lastError"] = (int) mqtt->lastError();
|
||||||
|
|
||||||
|
// not in use anymore and assumes that if configured ELIDX is alsway given..... Remove??
|
||||||
String domoStatus;
|
String domoStatus;
|
||||||
if(String(config->getDomoELIDX()).isEmpty()) {
|
if(String(config->getDomoELIDX()).isEmpty()) {
|
||||||
domoStatus = "secondary";
|
domoStatus = "secondary";
|
||||||
@@ -693,15 +693,11 @@ void AmsWebServer::handleSave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(server.hasArg("domoConfig") && server.arg("domoConfig") == "true") {
|
if(server.hasArg("domoConfig") && server.arg("domoConfig") == "true") {
|
||||||
if(server.hasArg("domo") && server.arg("domo") == "true") {
|
config->setDomoELIDX(server.arg("domoELIDX").toInt());
|
||||||
config->setDomoELIDX(server.arg("domoELIDX").toInt());
|
config->setDomoVL1IDX(server.arg("domoVL1IDX").toInt());
|
||||||
config->setDomoVL1IDX(server.arg("domoVL1IDX").toInt());
|
config->setDomoVL2IDX(server.arg("domoVL2IDX").toInt());
|
||||||
config->setDomoVL2IDX(server.arg("domoVL2IDX").toInt());
|
config->setDomoVL3IDX(server.arg("domoVL3IDX").toInt());
|
||||||
config->setDomoVL3IDX(server.arg("domoVL3IDX").toInt());
|
config->setDomoCL1IDX(server.arg("domoCL1IDX").toInt());
|
||||||
config->setDomoCL1IDX(server.arg("domoCL1IDX").toInt());
|
|
||||||
} else {
|
|
||||||
config->clearDomo();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user