@@ -151,7 +151,7 @@ void WundergroundClient::key(String key) {
151
151
isForecast = false ;
152
152
isAlerts = true ;
153
153
}
154
- // end fowlerk add
154
+ // end fowlerk add
155
155
}
156
156
157
157
void WundergroundClient::value (String value) {
@@ -252,12 +252,12 @@ void WundergroundClient::value(String value) {
252
252
if (currentKey == " observation_time_rfc822" ) {
253
253
date = value.substring (0 , 16 );
254
254
}
255
- // Begin add, fowlerk...04-Dec-2016
255
+ // Begin add, fowlerk...04-Dec-2016
256
256
if (currentKey == " observation_time" ) {
257
257
observationTime = value;
258
258
}
259
- // end add, fowlerk
260
-
259
+ // end add, fowlerk
260
+
261
261
if (currentKey == " temp_f" && !isMetric) {
262
262
currentTemp = value;
263
263
}
@@ -290,17 +290,17 @@ void WundergroundClient::value(String value) {
290
290
if (currentKey == " feelslike_f" && !isMetric) {
291
291
feelslike = value;
292
292
}
293
-
293
+
294
294
if (currentKey == " feelslike_c" && isMetric) {
295
295
feelslike = value;
296
296
}
297
-
297
+
298
298
if (currentKey == " UV" ) {
299
299
UV = value;
300
300
}
301
-
301
+
302
302
// end fowlerk add
303
-
303
+
304
304
if (currentKey == " dewpoint_f" && !isMetric) {
305
305
dewPoint = value;
306
306
}
@@ -316,10 +316,14 @@ void WundergroundClient::value(String value) {
316
316
if (currentKey == " period" ) {
317
317
currentForecastPeriod = value.toInt ();
318
318
}
319
+ if (currentKey == " pop" && isForecast && currentForecastPeriod < MAX_FORECAST_PERIODS) {
320
+ Serial.println (" Pop" + String (currentForecastPeriod) + " : " + value);
321
+ forecastPop[currentForecastPeriod] = value;
322
+ }
319
323
// Modified below line to add check to ensure we are processing the 10-day forecast
320
324
// before setting the forecastTitle (day of week of the current forecast day).
321
325
// (The keyword title is used in both the current observation and the 10-day forecast.)
322
- // Modified by fowlerk
326
+ // Modified by fowlerk
323
327
// if (currentKey == "title" && currentForecastPeriod < MAX_FORECAST_PERIODS) { // Removed, fowlerk
324
328
if (currentKey == " title" && isForecast && currentForecastPeriod < MAX_FORECAST_PERIODS) {
325
329
Serial.println (String (currentForecastPeriod) + " : " + value);
@@ -331,7 +335,7 @@ void WundergroundClient::value(String value) {
331
335
forecastText[currentForecastPeriod] = value;
332
336
}
333
337
// end fowlerk add, 12/3/16
334
-
338
+
335
339
// The detailed forecast period has only one forecast per day with low/high for both
336
340
// night and day, starting at index 1.
337
341
int dailyForecastPeriod = (currentForecastPeriod - 1 ) * 2 ;
@@ -364,19 +368,19 @@ void WundergroundClient::value(String value) {
364
368
currentForecastPeriod = 0 ;
365
369
}
366
370
forecastMonth[currentForecastPeriod] = value;
367
- }
371
+ }
368
372
369
373
if (currentKey == " day" && isSimpleForecast && currentForecastPeriod < MAX_FORECAST_PERIODS) {
370
374
// Added by fowlerk to handle transition from txtforecast to simpleforecast, as
371
375
// the key "period" doesn't appear until after some of the key values needed and is
372
376
// used as an array index.
373
377
if (isSimpleForecast && currentForecastPeriod == 19 ) {
374
378
currentForecastPeriod = 0 ;
375
- }
379
+ }
376
380
forecastDay[currentForecastPeriod] = value;
377
381
}
378
382
// end fowlerk add
379
-
383
+
380
384
}
381
385
382
386
void WundergroundClient::endArray () {
@@ -543,19 +547,24 @@ String WundergroundClient::getForecastLowTemp(int period) {
543
547
String WundergroundClient::getForecastHighTemp (int period) {
544
548
return forecastHighTemp[period];
545
549
}
550
+
551
+ String WundergroundClient::getForecastPrecipitationPercentage (int period) {
552
+ return forecastPop[period];
553
+ }
554
+
546
555
// fowlerk added...
547
556
String WundergroundClient::getForecastDay (int period) {
548
- // Serial.print("Day period: "); Serial.println(period);
557
+ // Serial.print("Day period: "); Serial.println(period);
549
558
return forecastDay[period];
550
559
}
551
560
552
561
String WundergroundClient::getForecastMonth (int period) {
553
- // Serial.print("Month period: "); Serial.println(period);
562
+ // Serial.print("Month period: "); Serial.println(period);
554
563
return forecastMonth[period];
555
564
}
556
565
557
566
String WundergroundClient::getForecastText (int period) {
558
- Serial.print (" Forecast period: " ); Serial.println (period);
567
+ Serial.print (" Forecast period: " ); Serial.println (period);
559
568
return forecastText[period];
560
569
}
561
570
// end fowlerk add
0 commit comments