Rules / Variables based on Date or Calendar

You can do this with the HTTP Action in SharpTools today. I agree that it makes for a good feature request as a native integration though to simplify this process for people who don’t have weather devices attached to their SmartThings. :smiley:

Let’s take the Open Weather /weather endpoint which provides the current weather. The URL is in the format:

https://api.openweathermap.org/data/2.5/weather?lat=-33&lon=96&appid={{ApiKey}}

And the response is in the format:

{
   "coord":{
      "lon":96,
      "lat":-33
   },
   "weather":[
      {
         "id":500,
         "main":"Rain",
         "description":"light rain",
         "icon":"10n"
      }
   ],
   "base":"stations",
   "main":{
      "temp":286.4,
      "feels_like":286.08,
      "temp_min":286.4,
      "temp_max":286.4,
      "pressure":1032,
      "humidity":88,
      "sea_level":1032,
      "grnd_level":1032
   },
   "visibility":10000,
   "wind":{
      "speed":6.89,
      "deg":143,
      "gust":7.83
   },
   "rain":{
      "1h":0.19
   },
   "clouds":{
      "all":97
   },
   "dt":1661023588,
   "sys":{
      "sunrise":1661040462,
      "sunset":1661080271
   },
   "timezone":21600,
   "id":0,
   "name":"",
   "cod":200
}

So if we wanted to get the main weather report, we would be looking for the weather.0.main element in the response. So we can make the HTTP call and then get the response data using Context Variables (Response > HTTP > Data) and use the object property notation to grab that nested property for use in our notification:

1 Like