@@ -69,9 +69,14 @@ const int SDC_PIN = 4; //D4;
69
69
// OpenWeatherMap Settings
70
70
// Sign up here to get an API key:
71
71
// https://docs.thingpulse.com/how-tos/openweathermap-key/
72
- const boolean IS_METRIC = true ;
73
72
String OPEN_WEATHER_MAP_APP_ID = " XXX" ;
74
- String OPEN_WEATHER_MAP_LOCATION = " Zurich,CH" ;
73
+ /*
74
+ Go to https://openweathermap.org/find?q= and search for a location. Go through the
75
+ result set and select the entry closest to the actual location you want to display
76
+ data for. It'll be a URL like https://openweathermap.org/city/2657896. The number
77
+ at the end is what you assign to the constant below.
78
+ */
79
+ String OPEN_WEATHER_MAP_LOCATION_ID = " 2657896" ;
75
80
76
81
// Pick a language code from this list:
77
82
// Arabic - ar, Bulgarian - bg, Catalan - ca, Czech - cz, German - de, Greek - el,
@@ -81,10 +86,11 @@ String OPEN_WEATHER_MAP_LOCATION = "Zurich,CH";
81
86
// Portuguese - pt, Romanian - ro, Russian - ru, Swedish - se, Slovak - sk,
82
87
// Slovenian - sl, Spanish - es, Turkish - tr, Ukrainian - ua, Vietnamese - vi,
83
88
// Chinese Simplified - zh_cn, Chinese Traditional - zh_tw.
84
-
85
89
String OPEN_WEATHER_MAP_LANGUAGE = " de" ;
86
90
const uint8_t MAX_FORECASTS = 4 ;
87
91
92
+ const boolean IS_METRIC = true ;
93
+
88
94
// Adjust according to your language
89
95
const String WDAY_NAMES[] = {" SUN" , " MON" , " TUE" , " WED" , " THU" , " FRI" , " SAT" };
90
96
const String MONTH_NAMES[] = {" JAN" , " FEB" , " MAR" , " APR" , " MAY" , " JUN" , " JUL" , " AUG" , " SEP" , " OCT" , " NOV" , " DEC" };
@@ -234,13 +240,13 @@ void updateData(OLEDDisplay *display) {
234
240
drawProgress (display, 30 , " Updating weather..." );
235
241
currentWeatherClient.setMetric (IS_METRIC);
236
242
currentWeatherClient.setLanguage (OPEN_WEATHER_MAP_LANGUAGE);
237
- currentWeatherClient.updateCurrent (¤tWeather, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION );
243
+ currentWeatherClient.updateCurrentById (¤tWeather, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID );
238
244
drawProgress (display, 50 , " Updating forecasts..." );
239
245
forecastClient.setMetric (IS_METRIC);
240
246
forecastClient.setLanguage (OPEN_WEATHER_MAP_LANGUAGE);
241
247
uint8_t allowedHours[] = {12 };
242
248
forecastClient.setAllowedHours (allowedHours, sizeof (allowedHours));
243
- forecastClient.updateForecasts (forecasts, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION , MAX_FORECASTS);
249
+ forecastClient.updateForecastsById (forecasts, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID , MAX_FORECASTS);
244
250
245
251
readyForWeatherUpdate = false ;
246
252
drawProgress (display, 100 , " Done..." );
0 commit comments