0 votes
asked in Touch Interface by (150 points)

Although I typed the city correctly in the setup of the sketch, the name of the city is not there


OK here is the settings for my city

.........Connected...Initializing touch screen...
Mounting file system...
PIFFS opened:
Time difference for DST: 3600
Getting url: http://api.openweathermap.org/data/2.5/weather?q=Radlett,GB&appid=****&units=metric&lang=en
[HTTP] GET... code: 200
start document
Getting url: http://api.openweathermap.org/data/2.5/forecast?q=Radlett,GB&appid=****&units=metric&lang=en
[HTTP] GET... code: 200
start document
DST Rules Updated:
DST Start: Sun Mar 25 02:00:00 2018
DST End:   Sun Oct 28 02:00:00 2018
commented by (9.6k points)
As remarked by email please accompany questions with an excerpt of `settings.h`, the serial monitor output (just copy&paste) and maybe a photo of the screen.
commented by (9.6k points)
Also, you may want to take a look at https://support.thingpulse.com/740/update-data-by-city-id to avoid issues with location /names/ altogether (new feature).
commented by (9.6k points)
I'll try to reproduce this later today.

1 Answer

0 votes
answered by (9.6k points)
Best answer

I can reproduce this behavior - but only for this specific location. There's a bug lingering somewhere. I have no idea what goes wrong, though.

  1. OWM returns the correct data; you can verify that by loading the URL displayed in the serial monitor in the browser
  2. The parsing in our weather station library looks sane: https://github.com/ThingPulse/esp8266-weather-station/blob/master/src/OpenWeatherMapCurrent.cpp#L186
  3. And the assignment in the app is obviously ok, too: https://github.com/ThingPulse/esp8266-weather-station-color/blob/2987803042f82eb330299e4cab70197730f87cf2/esp8266-weather-station-color.ino#L380

Rather than spending a lot of time hunting down that bug I opted to take a different route. The weather app for our ePaper product allows (i.e. requires) to configure the displayed location rather than relying on what OWM returns. The latest version for the color display, pushed a few min ago, now has that feature as well. One could moan about "yet another config param" but there are actually at least two advantages to this strategy:

  • OWM doesn't translate the city name. So,  even though you might select 'de' as your language and thus invoke the OWM API with xxx&lang=de it will return the English "Zurich" instead of the German "Zürich".
  • You may not want to display the location at all. In that case you can now simply define String DISPLAYED_CITY_NAME = ""; in settings.h.
commented by (3.3k points)
As OWM does not return a city name, doesn't this suggest a memory issue as if 'cityName' is being displayed as '' / Null then the location has been lost.  I notice the query returns a lot of data for Radlett, GB and there is only one Radlett,GB in the OWM list of stations, so no issues with multiple names. Clearly using the ID for location resolves any such issues.
commented by (9.6k points)
Yes, I also suspect(ed) a memory issue. I first thought about multiple TCP frames but the response for current weather is well below the 1500 bytes MTU limit. By coincidence someone reported the same (or similar) yesterday: https://github.com/ThingPulse/esp8266-weather-station/issues/131. Possible fix is to hand control back to SDK from time to time while parsing.
commented by (3.3k points)
edited by
I checked the Radlett response and was getting something like 14551 characters in response and with the ip protocol that’s about 10  packets worth. I note your request is not limited by using &cnt=8 for 1-days worth (each count is 3-hours), maybe you need less, so OWM sends all its data, that might be worth adding.

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.