@@ -77,12 +77,13 @@ const int SDC_PIN = 4; //D4;
77
77
// https://docs.thingpulse.com/how-tos/openweathermap-key/
78
78
String OPEN_WEATHER_MAP_APP_ID = " XXX" ;
79
79
/*
80
- Go to https://openweathermap.org/find?q= and search for a location. Go through the
81
- result set and select the entry closest to the actual location you want to display
82
- data for. It'll be a URL like https://openweathermap.org/city/2657896. The number
83
- at the end is what you assign to the constant below.
80
+ Use the OWM GeoCoder API to find lat/lon for your city: https://openweathermap.org/api/geocoding-api
81
+ Or use any other geocoding service.
82
+ Or go to https://openweathermap.org, search for your city and monitor the calls in the browser dev console :)
84
83
*/
85
- String OPEN_WEATHER_MAP_LOCATION_ID = " 2657896" ;
84
+ // Example: Zurich, Switzerland
85
+ float OPEN_WEATHER_MAP_LOCATION_LAT = 47.3667 ;
86
+ float OPEN_WEATHER_MAP_LOCATION_LON = 8.55 ;
86
87
87
88
// Pick a language code from this list:
88
89
// Arabic - ar, Bulgarian - bg, Catalan - ca, Czech - cz, German - de, Greek - el,
@@ -246,13 +247,13 @@ void updateData(OLEDDisplay *display) {
246
247
drawProgress (display, 30 , " Updating weather..." );
247
248
currentWeatherClient.setMetric (IS_METRIC);
248
249
currentWeatherClient.setLanguage (OPEN_WEATHER_MAP_LANGUAGE);
249
- currentWeatherClient.updateCurrentById (¤tWeather, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID );
250
+ currentWeatherClient.updateCurrent (¤tWeather, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_LAT, OPEN_WEATHER_MAP_LOCATION_LON );
250
251
drawProgress (display, 50 , " Updating forecasts..." );
251
252
forecastClient.setMetric (IS_METRIC);
252
253
forecastClient.setLanguage (OPEN_WEATHER_MAP_LANGUAGE);
253
254
uint8_t allowedHours[] = {12 };
254
255
forecastClient.setAllowedHours (allowedHours, sizeof (allowedHours));
255
- forecastClient.updateForecastsById (forecasts, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_ID , MAX_FORECASTS);
256
+ forecastClient.updateForecasts (forecasts, OPEN_WEATHER_MAP_APP_ID, OPEN_WEATHER_MAP_LOCATION_LAT, OPEN_WEATHER_MAP_LOCATION_LON , MAX_FORECASTS);
256
257
257
258
readyForWeatherUpdate = false ;
258
259
drawProgress (display, 100 , " Done..." );
0 commit comments