@@ -77,12 +77,13 @@ const int SDC_PIN = 4; //D4;
7777// https://docs.thingpulse.com/how-tos/openweathermap-key/
7878String OPEN_WEATHER_MAP_APP_ID = " XXX" ;
7979/*
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 :)
8483 */
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 ;
8687
8788// Pick a language code from this list:
8889// Arabic - ar, Bulgarian - bg, Catalan - ca, Czech - cz, German - de, Greek - el,
@@ -246,13 +247,13 @@ void updateData(OLEDDisplay *display) {
246247 drawProgress (display, 30 , " Updating weather..." );
247248 currentWeatherClient.setMetric (IS_METRIC);
248249 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 );
250251 drawProgress (display, 50 , " Updating forecasts..." );
251252 forecastClient.setMetric (IS_METRIC);
252253 forecastClient.setLanguage (OPEN_WEATHER_MAP_LANGUAGE);
253254 uint8_t allowedHours[] = {12 };
254255 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);
256257
257258 readyForWeatherUpdate = false ;
258259 drawProgress (display, 100 , " Done..." );
0 commit comments