This project is a take on one we've done before, the Dark Sky API Weather Dashboard. This time instead of a Raspberry Pi, we'll use an Adafruit PyPortal to display weather data and send that data to Initial State. Two dashboards for the work of one!
Initial State is a data visualization platform. We will send data from Dark Sky API and the PyPortal to Initial State. This will allow us to have a log of the weather data and view weather trends.
You'll need to register and create a new account. You get a 14 day free trial and anyone with an edu email address can register for a free student plan.
You'll need your Initial State Access Key to be able to send data from the Dark Sky API and the PyPortal to Initial State. Scroll over your username in the top right and click my settings. There you will see a list of Streaming Access Keys. Select one to use or create a new one. We will need this later for the code.
Dark Sky API
Dark Sky specializes in weather forecasting and visualization. The coolest aspect of Dark Sky is their weather API that we can use to retrieve the weather data from almost anywhere in the world. It's not just weather is rainy or sunny but temperature, dew point, wind gust, humidity, precipitation, pressure, UV index, and more, all easily available for wherever you want, whenever you want.
In order to use the Dark Sky API, you first need your own API key. Don't worry, getting an API key is quick and free. All you need to do is go to the website and click "Try for Free" to create an account.
You get 1, 000 API calls for free each day. Every API request over the free daily limit costs $0.0001.This limit automatically resets each day at midnight UTC.The Forecast Request returns the current weather forecast for the next week.The Time Machine Request returns the observed or forecast weather conditions for a date in the past or future.
Your secret Dark Sky API key will look something like this:
We will use this later in the code.
Adafruit IO & PyPortal
Adafruit IO is service Adafruit offers to supplement their hardware. We will use this service for the clock part of our code. Sign up for a free account. Click the View AIO Key on the left to see your username and key. We will use both of these later in our code later.
The Adafruit PyPortal is the latest IoT device powered by Circuit Python. The cool thing about the PyPortal is you can interact with API’s and JSONs to display almost anything. We will use it to get data from the Dark Sky API, display that data on the PyPortal, and send that data to Initial State.
If this is your first project on your PyPortal, you'll want to follow this tutorial to download the firmware, connect your PyPortal to WiFi, and get it ready. Once you complete this we will be ready to the Dark Sky API code.