OpenSprinkler Forums Third-Party Software wrong dates with WeatherUnderground API Reply To: wrong dates with WeatherUnderground API

#65094

akom
Participant

Confirmed that was it.
I worked around it in a way that would still work on official boards, and would also help if an RTC failed:

===================================================================
--- main.cpp	(revision 798d2fea340b9bccdb317a7bac285a5d3c31d33a)
+++ main.cpp	(date 1586518946000)
@@ -297,9 +297,14 @@
 
 	pd.init();						// ProgramData init
 
-	setSyncInterval(RTC_SYNC_INTERVAL);  // RTC sync interval
-	// if rtc exists, sets it as time sync source
-	setSyncProvider(RTC.get);
+	if (RTC.detect()) {
+		setSyncInterval(RTC_SYNC_INTERVAL);  // RTC sync interval
+		// if rtc exists, sets it as time sync source
+		setSyncProvider(RTC.get);
+	}
+	// else no RTC: relying on NTP and for the clock to be somewhat accurate.
+	// May need to reduce NTP interval if the drift is bad
+
 	os.lcd_print_time(os.now_tz());  // display time to LCD
 	os.powerup_lasttime = os.now_tz();

Happy to make a PR if that’s appropriate.

Many thanks for the guidance.