"NTP:NACK"
Incredible work, thank you! I was wondering, is the NTP server still working in your build? I've not had any success and I've not edited your code.
if you're using an ESP32 its probably easier to use the NTP built into the core library. I did something like:
struct tm timeinfo;
const char * ntpServer1 = "95.211.212.5"; // "nl.pool.ntp.org"
const char * ntpServer2 = "91.148.192.49"; // "pool.ntp.org"
const char * tz = "CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00"; // get from https://remotemonitoringsystems.ca/time-zone-abbreviations.php
configTzTime(tz, ntpServer1, ntpServer2);
if (!getLocalTime(&timeinfo, 3000)) {
Serial.println("Error getting time"); // will timeout after 3 seconds
}
Serial.printf("Time is %02d:%02d:%02d on %02d/%02d/%02d weekday %d\n",
timeinfo.tm_hour,
timeinfo.tm_min,
timeinfo.tm_sec,
timeinfo.tm_mday,
timeinfo.tm_mon,
1900 + timeinfo.tm_year,
timeinfo.tm_wday);
Thank you very much, I'll give that a go in the near future :)
As a follow-up, for anyone else, I found that the first time the code runs on the ESP32 I get the "NACK" outcome but the following time around it works. I also found using a local NTP server (TPG) worked. Not sure why at this stage but it works.
#define NTP_SERVER 203,12,160,2 //TPG Server
and
#define TIMEZONE 0.5 // (for South Australia)