Hello.
I am working on a commercial prototype project: pumping station plant. OPTA: center star of the stage.
The issue I am facing is that the RTC sync with traditional NTPClient syn method has stopped working. RTC has gone 0. Trying to open pool.ntp.org redirects to a vague video with shady url.
I did some study regarding NTP org and learned its prone to cyber-attacks and ain't reliable for business purposes.
While mapping variables on cloud, I found CLoudTime and I am trying to write into a local variable in PLC for event stamping purpose, but it shows 0 in Debug.
No compilation error, cloud connection healthy, other variable syncing.
Attached the snips below.
Kindly advise solution
This was the inital and worked fine for 2 days //
in setup
// NTP client object initialization and time update, display updated time on the Serial Monitor.
timeClient.begin();
timeClient.update();
const unsigned long epoch = timeClient.getEpochTime();
set_time(epoch);
}
in loop with delay
PLCIn.sync_time = time(NULL) ;
Then I tried cloud time, it gets compiled without warnings downloaded on the OPTA, but PLCIn.sync_time = 0 in debug. Below are snips:
var declare
CloudTime cloud_time;
in init properties
ArduinoCloud.addProperty(cloud_time, READWRITE, 60 * SECONDS, onCloudTimeChange);
void onCloudTimeChange() {
// Add your code here to act upon CloudTime change
PLCIn.sync_time = cloud_time ;
}