Weather API

As we mentioned earlier, apart from temperature and humidity, we will measure wind speed, atmospheric pressure, and sunrise and sunset times using free and open source weather APIs.

Quite a few weather APIs are available for free. We will use the OpenWeatherMap API, which is easy to use and requires just a simple registration on their website to get started. It provides a REST-based API endpoint to get the weather data in JSON format. As input parameters, we need to provide a city ID, which is provided on the website itself, and APPID, which you will get after registration.

Let's go through the registration process and see how it works:

  1. Log on to http://www.openweathermap.com/ and click on Sign Up.
  2. A registration page will appear; ...

Get Internet of Things with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.