Always getting the same conditions code from the OpenWeatherMap API

My local weather app is now complete (I’ve even fixed the button animation bugs), but I seem to always get the same conditions code form OpenWeatherMap (namely 200, in other words, I think, light thunderstorms). In any case, because the background image is determined by this code, I’ve never seen the app display any other image but thunderstorms. Has anyone else run into this problem? Is this an issue with my app, or with the API?

Thanks in advance for any ideas on this.

Change code to this.

bgCode = data.weather[0].id;

Edit: Also you could use https://geoip-db.com instead of http://ip-api.com since uBlock Origin adblocker blocks the second link for me at least.

Thank you! It worked.