@@ -169,7 +169,7 @@ void WundergroundClient::key(String key) {
169169 isForecast = false ;
170170 isAlerts = true ;
171171 }
172- // end fowlerk add
172+ // end fowlerk add
173173}
174174
175175void WundergroundClient::value (String value) {
@@ -247,7 +247,7 @@ void WundergroundClient::value(String value) {
247247 else isPM = false ;
248248 char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
249249 sprintf (tempHourBuff, " %2d" , tempHour); // fowlerk add for formatting, 12/22/16
250- moonriseTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
250+ moonriseTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
251251 // moonriseTime = value;
252252 }
253253 if (currentKey == " minute" ) {
@@ -263,7 +263,7 @@ void WundergroundClient::value(String value) {
263263 if (currentKey == " hour" ) {
264264 char tempHourBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
265265 sprintf (tempHourBuff, " %2d" , value.toInt ()); // fowlerk add for formatting, 12/22/16
266- moonsetTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
266+ moonsetTime = String (tempHourBuff); // fowlerk add for formatting, 12/22/16
267267 }
268268 if (currentKey == " minute" ) {
269269 char tempMinBuff[3 ] = " " ; // fowlerk add for formatting, 12/22/16
@@ -275,7 +275,7 @@ void WundergroundClient::value(String value) {
275275 if (currentKey == " wind_mph" && !isMetric) {
276276 windSpeed = value + " mph" ;
277277 }
278-
278+
279279 if (currentKey == " wind_kph" && isMetric) {
280280 windSpeed = value + " km/h" ;
281281 }
@@ -286,15 +286,19 @@ void WundergroundClient::value(String value) {
286286
287287// end JJG add ////////////////////////////////////////////////////////////////////
288288
289- if (currentKey == " observation_time_rfc822 " ) {
289+ if (currentKey == " local_time_rfc822 " ) {
290290 date = value.substring (0 , 16 );
291291 }
292- // Begin add, fowlerk...04-Dec-2016
292+
293+ if (currentKey == " observation_time_rfc822" ) {
294+ observationDate = value.substring (0 , 16 );
295+ }
296+ // Begin add, fowlerk...04-Dec-2016
293297 if (currentKey == " observation_time" ) {
294298 observationTime = value;
295299 }
296- // end add, fowlerk
297-
300+ // end add, fowlerk
301+
298302 if (currentKey == " temp_f" && !isMetric) {
299303 currentTemp = value;
300304 }
@@ -327,15 +331,15 @@ void WundergroundClient::value(String value) {
327331 if (currentKey == " feelslike_f" && !isMetric) {
328332 feelslike = value;
329333 }
330-
334+
331335 if (currentKey == " feelslike_c" && isMetric) {
332336 feelslike = value;
333337 }
334-
338+
335339 if (currentKey == " UV" ) {
336340 UV = value;
337341 }
338-
342+
339343 // Active alerts...added 18-Dec-2016
340344 if (currentKey == " type" && isAlerts) {
341345 activeAlertsCnt++;
@@ -399,9 +403,9 @@ void WundergroundClient::value(String value) {
399403 activeAlertsAttribution[currentAlert-1 ].replace (" </a>" ," " );
400404 activeAlertsAttribution[currentAlert-1 ].replace (" /'>" ," " );
401405 }
402-
406+
403407 // end fowlerk add
404-
408+
405409 if (currentKey == " dewpoint_f" && !isMetric) {
406410 dewPoint = value;
407411 }
@@ -420,7 +424,7 @@ void WundergroundClient::value(String value) {
420424// Modified below line to add check to ensure we are processing the 10-day forecast
421425// before setting the forecastTitle (day of week of the current forecast day).
422426// (The keyword title is used in both the current observation and the 10-day forecast.)
423- // Modified by fowlerk
427+ // Modified by fowlerk
424428 // if (currentKey == "title" && currentForecastPeriod < MAX_FORECAST_PERIODS) { // Removed, fowlerk
425429 if (currentKey == " title" && isForecast && currentForecastPeriod < MAX_FORECAST_PERIODS) {
426430 Serial.println (String (currentForecastPeriod) + " : " + value);
@@ -436,13 +440,13 @@ void WundergroundClient::value(String value) {
436440 forecastText[currentForecastPeriod] = value;
437441 }
438442 // end fowlerk add, 12/3/16
439-
443+
440444 // Added PoP (probability of precipitation) key following...fowlerk, 12/22/16
441445 if (currentKey == " pop" && isForecast && currentForecastPeriod < MAX_FORECAST_PERIODS) {
442446 PoP[currentForecastPeriod] = value;
443447 }
444448 // end fowlerk add, 12/22/16
445-
449+
446450 // The detailed forecast period has only one forecast per day with low/high for both
447451 // night and day, starting at index 1.
448452 int dailyForecastPeriod = (currentForecastPeriod - 1 ) * 2 ;
@@ -475,19 +479,19 @@ void WundergroundClient::value(String value) {
475479 currentForecastPeriod = 0 ;
476480 }
477481 forecastMonth[currentForecastPeriod] = value;
478- }
482+ }
479483
480484 if (currentKey == " day" && isSimpleForecast && currentForecastPeriod < MAX_FORECAST_PERIODS) {
481485 // Added by fowlerk to handle transition from txtforecast to simpleforecast, as
482486 // the key "period" doesn't appear until after some of the key values needed and is
483487 // used as an array index.
484488 if (isSimpleForecast && currentForecastPeriod == 19 ) {
485489 currentForecastPeriod = 0 ;
486- }
490+ }
487491 forecastDay[currentForecastPeriod] = value;
488492 }
489493 // end fowlerk add
490-
494+
491495}
492496
493497void WundergroundClient::endArray () {
@@ -548,6 +552,9 @@ String WundergroundClient::getSeconds() {
548552String WundergroundClient::getDate () {
549553 return date;
550554}
555+ String WundergroundClient::getObservationDate () {
556+ return observationDate;
557+ }
551558long WundergroundClient::getCurrentEpoch () {
552559 return localEpoc + ((millis () - localMillisAtUpdate) / 1000 );
553560}
@@ -698,17 +705,17 @@ String WundergroundClient::getForecastHighTemp(int period) {
698705}
699706// fowlerk added...
700707String WundergroundClient::getForecastDay (int period) {
701- // Serial.print("Day period: "); Serial.println(period);
708+ // Serial.print("Day period: "); Serial.println(period);
702709 return forecastDay[period];
703710}
704711
705712String WundergroundClient::getForecastMonth (int period) {
706- // Serial.print("Month period: "); Serial.println(period);
713+ // Serial.print("Month period: "); Serial.println(period);
707714 return forecastMonth[period];
708715}
709716
710717String WundergroundClient::getForecastText (int period) {
711- // Serial.print("Forecast period: "); Serial.println(period);
718+ // Serial.print("Forecast period: "); Serial.println(period);
712719 return forecastText[period];
713720}
714721
@@ -761,4 +768,4 @@ String WundergroundClient::getMeteoconIcon(String iconText) {
761768 if (iconText == " nt_tstorms" ) return " &" ;
762769
763770 return " )" ;
764- }
771+ }
0 commit comments