Fernhill SCADA Connection to OpenWeatherMap

Help Contents

Introduction

The OpenWeatherMap Internet Service provides weather data for most places around the world. The service provides basic information at no cost, and more detailed information for a fee.

Using the URL Scanner Tag you can:

This page shows you how to retrieve and store weather data using Fernhill SCADA.

The instructions show you how to:

1. Obtain an API Key from OpenWeatherMap

To read any data from the OpenWeatherMap Service, you need to obtain an API Key. To do this:

  1. In a web browser, open the page https://openweathermap.org/.
  2. Click Sign Up. The Create New Account page opens.
  3. Enter your User Name, Email Address and Password.
  4. Check the required options.
  5. Click Create Account.
  6. You should then receive an email with your API key. A typical key consists of 32 letters and numbers, for example:

    a4ef3b66fe364d43e8e17376063exxxx

2. Create the URL Scanner Tag

In the Configuration Tool, do the following:

  1. In the Tag Window, right click on the database root and select Add new folder.
  2. Enter the name OpenWeatherMap.
  3. Press Return.
  4. Right click on the new OpenWeatherMap folder and select Add new tag, followed by File Driver, followed by URL Scanner.
  5. Press Return to accept the default name "URL Scanner"
  6. In the Properties Window, enter these values:

    PropertyValue
    FileType JSON
    ReadInterval 3h
    URL https://api.openweathermap.org/data/2.5/forecast?q=London&APPID=KEY

    Note: Replace the KEY part of the URL with the API key you received in the email in step 1.

  7. Check the Configuration Tool Status Monitor to confirm the URL Scanner is Online. If there is a problem check the URL property is configured correctly.

3. Configure a Data Point Tag to Show the Temperature in 24 Hours Time

  1. In the Tag Window do the following:
    1. Right click on the OpenWeatherMap folder.
    2. select Add new tag, followed by Core, followed by I/O Analog Data Point Tag.
    3. Enter the name Temp +24h.
    4. Press Return.
  2. In the Properties Window, enter these values:

    PropertyValue
    MaxScale 100
    MinScale -273
    RawScaleMax 373
    RawScaleMin 0

    Note: OpenWeatherMap reports temperatures in Kelvin. These scaling parameters change the scale to Celsius.

  3. In the IODataSource field, click on the Browse button Browse button to open the Browse Tags dialog.
  4. Select the entry URL Scanner then click OK.
  5. In the IOItemName field, click on the Browse button Browse button to open the Browse Property Values dialog.
  6. Expand the list entry.
  7. Expand the [8] entry.

    Note: Each entry in the array represents a 3 hour interval. Index 8 represents the weather 24 hours in the future.

  8. Expand the main entry.
  9. Select temp entry and click OK.
  10. Check the Configuration Tool Status Monitor to confirm the Temp +24h tag is showing an appropriate value. If there is a problem check the IODataSource and IOItemName properties are configured correctly.

Further Information

Data File Driver

For an overview of the Data File Driver.

Glossary

For the meaning of terms used in Fernhill SCADA.