NTP server is used from configuration setting

This commit is contained in:
Ollo 2020-11-01 20:29:24 +01:00
parent e0de8dabe8
commit 89070806f7

View File

@ -399,9 +399,11 @@ void onHomieEvent(const HomieEvent& event) {
Homie.getLogger() << "My statistics" << endl;
break;
case HomieEventType::MQTT_READY:
Serial.printf("NTP Setup with server %s\r\n", ntpServer.get());
configTime(0, 0, ntpServer.get());
//wait for rtc sync?
rtcDeepSleepTime = deepSleepTime.get();
Serial << "MQTT ready " << endl;
Serial << "Setup plants" << endl;
for(int i=0; i < MAX_PLANTS; i++) {
mPlants[i].postMQTTconnection();
}
@ -484,7 +486,7 @@ bool aliveHandler(const HomieRange& range, const String& value) {
}
void homieLoop(){
}
void systemInit(){
@ -510,8 +512,6 @@ void systemInit(){
//Homie.disableLogging();
Homie.setup();
configTime(0, 0, ntpServer.get());
mConfigured = Homie.isConfigured();
if (mConfigured) {
for(int i=0; i < MAX_PLANTS; i++) {