Updating MagTag WX for OpenWeatherMap API 3.0

A couple of years ago, I put an Adafruit MagTag Weather display together.  The MagTag was a fairly inexpensive CircuitPython device with an eInk display and built-in WiFi.  It used a free (at that time) service called OpenWeatherMap API

Within the past month, OpenWeatherMap changed their policy and now requires a credit card to validate the API key, but they still don’t charge for up to 1,000 API calls per day.  Their interface allows you to set restrictions on the maximum API calls per day (it defaults to 2,000).  In my case I set it down to 500, so I never have to worry about a software bug causing me to get billed.

The code.py program that Adafruit supplies currently, is out of date, as it uses the API 2.5, which has been replaced by API 3.0.  The change needed to the source file is trivial – simply change the line that has the 2.5 reference to 3.0 and you are all done.  Like this:

URL = “https://api.openweathermap.org/data/3.0/onecall?exclude=minutely,hourly,alerts”

Note: I had edited the original bitmap background image to add my call on the top line.

This entry was posted in Projects, Weather. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *