Various changes after testing new HA features

This commit is contained in:
Gunnar Skjold
2023-04-01 07:31:40 +02:00
parent f214af3595
commit 71e0f13f0e
9 changed files with 56 additions and 38 deletions

View File

@@ -1497,6 +1497,7 @@ void configFileParse() {
bool lMeter = false;
bool lGpio = false;
bool lDomo = false;
bool lHa = false;
bool lNtp = false;
bool lEntsoe = false;
bool lEac = false;
@@ -1510,6 +1511,7 @@ void configFileParse() {
MeterConfig meter;
GpioConfig gpio;
DomoticzConfig domo;
HomeAssistantConfig haconf;
NtpConfig ntp;
EntsoeConfig entsoe;
EnergyAccountingConfig eac;
@@ -1679,6 +1681,15 @@ void configFileParse() {
} else if(strncmp_P(buf, PSTR("domoticzCl1idx "), 15) == 0) {
if(!lDomo) { config.getDomoticzConfig(domo); lDomo = true; };
domo.cl1idx = String(buf+15).toInt();
} else if(strncmp_P(buf, PSTR("homeAssistantDiscoveryPrefix "), 28) == 0) {
if(!lHa) { config.getHomeAssistantConfig(haconf); lHa = true; };
strcpy(haconf.discoveryPrefix, buf+28);
} else if(strncmp_P(buf, PSTR("homeAssistantDiscoveryHostname "), 30) == 0) {
if(!lHa) { config.getHomeAssistantConfig(haconf); lHa = true; };
strcpy(haconf.discoveryHostname, buf+30);
} else if(strncmp_P(buf, PSTR("homeAssistantDiscoveryNameTag "), 29) == 0) {
if(!lHa) { config.getHomeAssistantConfig(haconf); lHa = true; };
strcpy(haconf.discoveryNameTag, buf+29);
} else if(strncmp_P(buf, PSTR("ntpEnable "), 10) == 0) {
if(!lNtp) { config.getNtpConfig(ntp); lNtp = true; };
ntp.enable = String(buf+10).toInt() == 1;
@@ -1902,6 +1913,7 @@ void configFileParse() {
if(lMeter) config.setMeterConfig(meter);
if(lGpio) config.setGpioConfig(gpio);
if(lDomo) config.setDomoticzConfig(domo);
if(lHa) config.setHomeAssistantConfig(haconf);
if(lNtp) config.setNtpConfig(ntp);
if(lEntsoe) config.setEntsoeConfig(entsoe);
if(lEac) config.setEnergyAccountingConfig(eac);