Resources

Renesas IoT Sandbox Documentation

OpenWeatherMap Library

The following functions provide OpenWeatherMap weather capabilities to get current weather and 5 day forecasts by longitutde/latitue coordinates. If you do not have a OpenWeatherMap account, you can use the Weather Library instead although it will use 100 Workflow Credits instead of 1.


Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import OpenWeatherMap


Functions


OpenWeatherMap.get_weather_by_coordinates

Usage: OpenWeatherMap.get_weather_by_coordinates(lat, lon, apikey)

Get current weather by geo coordinates

  • Credit cost: 1
  • Parameters:
    • lat: double latitude
    • lon: double longitude
    • apikey: string OpenWeatherMap API Key
  • Returns: json


OpenWeatherMap.get_5_day_forecast_by_coordinates

Usage: OpenWeatherMap.get_5_day_forecast_by_coordinates(lat, lon, apikey)

Get 5 day forecast by geo coordinates

  • Credit cost: 1
  • Parameters:
    • lat: double latitude
    • lon: double longitude
    • apikey: string OpenWeatherMap API Key
  • Returns: json

Sample Code

import OpenWeatherMap
import json

lat = 37.426048
lon = -121.975243

data = OpenWeatherMap.get_weather_by_coordinates(lat, lon, apikey)
log(json.dumps(data))

Returns:


{
   "main":{
      "temp":292.6,
      "pressure":1010,
      "temp_max":297.15,
      "temp_min":286.48,
      "humidity":41
   },
   "clouds":{
      "all":5
   },
   "sys":{
      "country":"US",
      "sunrise":1473169384,
      "type":1,
      "message":0.0037,
      "sunset":1473215296,
      "id":480
   },
   "dt":1473130255,
   "coord":{
      "lon":-121.98,
      "lat":37.43
   },
   "weather":[
      {
         "icon":"50n",
         "description":"mist",
         "main":"Mist",
         "id":701
      }
   ],
   "name":"Alviso",
   "cod":200,
   "id":5323631,
   "base":"cmc stations",
   "wind":{
      "deg":310,
      "speed":4.1
   }
}

Getting Started
User Roles & Permissions
Streams, Tags, & Data Types
Dashboard Widgets
API
Workflow Studio
Workflow Libraries
Metering
Special Characters
Third Party Integration
Mobile
API Explorer

OpenWeatherMap Library

The following functions provide OpenWeatherMap weather capabilities to get current weather and 5 day forecasts by longitutde/latitue coordinates. If you do not have a OpenWeatherMap account, you can use the Weather Library instead although it will use 100 Workflow Credits instead of 1.


Import


To use this library and its functions, you must use the import line at the beginning of your Base Python code.

import OpenWeatherMap


Functions


OpenWeatherMap.get_weather_by_coordinates

Usage: OpenWeatherMap.get_weather_by_coordinates(lat, lon, apikey)

Get current weather by geo coordinates

  • Credit cost: 1
  • Parameters:
    • lat: double latitude
    • lon: double longitude
    • apikey: string OpenWeatherMap API Key
  • Returns: json


OpenWeatherMap.get_5_day_forecast_by_coordinates

Usage: OpenWeatherMap.get_5_day_forecast_by_coordinates(lat, lon, apikey)

Get 5 day forecast by geo coordinates

  • Credit cost: 1
  • Parameters:
    • lat: double latitude
    • lon: double longitude
    • apikey: string OpenWeatherMap API Key
  • Returns: json

Sample Code

import OpenWeatherMap
import json

lat = 37.426048
lon = -121.975243

data = OpenWeatherMap.get_weather_by_coordinates(lat, lon, apikey)
log(json.dumps(data))

Returns:


{
   "main":{
      "temp":292.6,
      "pressure":1010,
      "temp_max":297.15,
      "temp_min":286.48,
      "humidity":41
   },
   "clouds":{
      "all":5
   },
   "sys":{
      "country":"US",
      "sunrise":1473169384,
      "type":1,
      "message":0.0037,
      "sunset":1473215296,
      "id":480
   },
   "dt":1473130255,
   "coord":{
      "lon":-121.98,
      "lat":37.43
   },
   "weather":[
      {
         "icon":"50n",
         "description":"mist",
         "main":"Mist",
         "id":701
      }
   ],
   "name":"Alviso",
   "cod":200,
   "id":5323631,
   "base":"cmc stations",
   "wind":{
      "deg":310,
      "speed":4.1
   }
}