Open Weather Map Agent

<< Click to Display Table of Contents >>

EQuIS 7  >>  Enterprise > EQuIS Live > Agents >

Open Weather Map Agent

The Open Weather Map Agent is a data loading agent available in EQuIS Live for obtaining current weather data from Open Weather Map.

 

Open Weather Map allows users to request current weather data, up to 60 calls per minute for free; it provides weather data for over 200,000 cities.

 

Adding Location

 

Before using the Open Weather Map Agent, add one or more locations to the DT_LOGGER table:

1.Obtain an API key from Open Weather Map.

2.Execute the equis.get_ids stored procedure to get a new LOGGER_ID or add the location (DT_LOGGER row) in EQuIS Professional.

3.Set LIVE_DATA_SOURCE to a Uniform Resource Identifier (URI) that can be used to request the location's current weather data:
 
e.g. https://api.openweathermap.org/data/2.5/weather?id=6182962&appid=7883671a09db2ae69d6c380ba&units=metric where 6182962 is the location's ID and 7883671a09db2ae69d6c380ba is the API key.
 
Users can search for a location by name and get its ID from the search result link's URI. (For example, searching for London, UK, returns https://openweathermap.org/city/2643743, and 2643743 is the location ID.)
 
Users can also search for a location using a map. This won't give the location ID but will give the name, which can then be searched for.

 

Note: Open Weather Map's Current Weather Data page has additional URI examples; you can also request a location's current weather data using a city name, latitude and longitude, or ZIP code, in addition to a location ID.

If units are unspecified in the URI (metric or imperial), the default units (e.g., temperatures in Kelvin) will be returned.

The Open Weather Map Agent only allows one location per logger, and only supports JavaScript Object Notation (JSON), not XML.

 

4.Set LOGGER_CODE to anything (e.g., the location name or ID); it's not used, but cannot be NULL.

5.Optional - If you would like to encrypt the API key, please contact support@earthsoft.com. Once the encrypted key is received back from EarthSoft, set CUSTOM_FIELD_1 to your encrypted API key and LIVE_DATA_SOURCE to something resembling the example below:
 
e.g. https://api.openweathermap.org/data/2.5/weather?id=6182962&appid=${api_key}&units=metric
where 6182962 is the location's ID and ${api_key} represents the encrypted API key (in CUSTOM_FIELD_1).  
 

6.Set STATUS_FLAG to 'A' to activate the logger.

 

Loading Data

 

The Open Weather Map Agent can be run as a scheduled EQuIS Information Agent (EIA), at the desired frequency, to automatically load data as often as needed.

 

The Open Weather Map Agent can also be run in EQuIS Professional or Enterprise (using the EZView widget) to load the data manually, without having to schedule an EIA.

 

The Open Weather Map Agent will load data for all loggers with LIVE_DATA_SOURCE containing api.openweathermap.org.

 

The Open Weather Map Agent adds a DT_LOGGER_SERIES row for each of the following series. However, some of the locations may not have one or more of the series listed below, in which case those series will not be added.

 

SERIES_NAME

SERIES_DESC

STATUS_FLAG *

main.temp

Temperature. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit.

A

main.pressure

Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPa

A

main.humidity

Humidity, %

A

main.temp_min

Minimum temperature at the moment. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded.

R

main.temp_max

Maximum temperature at the moment. Unit Default: Kelvin, Metric: Celsius, Imperial: Fahrenheit. This is deviation from current temp that is possible for large cities and megalopolises geographically expanded.

R

main.sea_level

Atmospheric pressure on the sea level, hPa

R

main.grnd_level

Atmospheric pressure on the ground level, hPa

R

wind.speed

Wind speed. Unit Default: meter/sec, Metric: meter/sec, Imperial: miles/hour.

A

wind.deg

Wind direction, degrees (meteorological)

A

 

* The STATUS_FLAG column value is the initial status flag when the series is added. A series can then be activated or deactivated, by setting its STATUS_FLAG = 'A' or 'R', to start or stop (respectively) obtaining data for it. Note that STATUS_FLAG = 'R' is initially assigned to some of the series.

 

A series' SERIES_DESC and SERIES_UNIT may be changed, but not the SERIES_NAME; it uniquely identifies the series.