Rules and Expressions with Open Weather API

Thanks, no use reinventing the wheel.

Oooohhh Im getting !.. how can I know all the “value using expression” I can get from openweather ? b.e. I can see: “data.daily.0.temp.max” and “…min”… which others ? THANKS !

Check out OpenWeatherMap API guide - OpenWeatherMap

There are about 1700 line items that are returned with the API call. Basically anything you can imagine is there.

1 Like

thanks my friend…You rock !!

Hi my friend. This is really cool…I had made some attempts with that…and it works for:

  • round($
  • round($
  • round($

And they work !!.. but I had not got set next ones, Sharptools variables are text type, but they are set to blanks when rule is triggered, do you know why ?:

  • $
  • $

In other idea the “0” value in .daily.0 expression is referred to number of the day ? …how can I get temperature o weather forecasting for next day ?


Based on their sample data, it looks like the current weather is nested within an array.

  "lat": 39.31,
  "lon": -74.5,
  "timezone": "America/New_York",
  "timezone_offset": -18000,
  "current": {
    "dt": 1646318698,
    "sunrise": 1646306882,
    "sunset": 1646347929,
    "temp": 282.21,
    "feels_like": 278.41,
    "pressure": 1014,
    "humidity": 65,
    "dew_point": 275.99,
    "uvi": 2.55,
    "clouds": 40,
    "visibility": 10000,
    "wind_speed": 8.75,
    "wind_deg": 360,
    "wind_gust": 13.89,
    "weather": [
        "id": 802,
        "main": "Clouds",
        "description": "scattered clouds",
        "icon": "03d"

Notice that immediately after "weather": there is a [ which indicates an array. That means you would need something like the following to grab the first array item.


Like the above, the 0 is referring to the position of the item within the array. Arrays start at ‘0’ rather than ‘1’. You can find more details on how properties are accessed from objects in this thread.

1 Like

Thanks Josh… I will play around with it while enjoy the World Cup !!

1 Like

Don’t know if this is relevant here, but Todd Austin has made an Edge weatherstation.
The catch is it needs his edgebridge running on a server to link to an API. Since I have my camera server running and also using his phone presence app, I added this one as well. Simply use it in a rule or create a tile with the relevant info…


This is a long shot from me !!


Nested array !

1 Like

That looks right.

For future reference here is an example of the data found under each of the 9 days of DAILY data provided by the OneCall API.

    "daily": [
            "dt": 1669662000,
            "sunrise": 1669647705,
            "sunset": 1669682682,
            "moonrise": 1669665600,
            "moonset": 1669701420,
            "moon_phase": 0.18,
            "temp": {
                "day": 55.92,
                "min": 46.11,
                "max": 58.71,
                "night": 46.11,
                "eve": 57.33,
                "morn": 47.46
            "feels_like": {
                "day": 53.65,
                "night": 45.1,
                "eve": 55.06,
                "morn": 46.38
            "pressure": 1014,
            "humidity": 52,
            "dew_point": 38.05,
            "wind_speed": 6.89,
            "wind_deg": 157,
            "wind_gust": 11.63,
            "weather": [
                    "id": 803,
                    "main": "Clouds",
                    "description": "broken clouds",
                    "icon": "04d"
            "clouds": 81,
            "pop": 0.06,
            "uvi": 1.78
1 Like

This is what I use.

1 Like

I should have been clear that I was referring to the format only. The number after daily should correspond to the day for data is wanted.

This is really cool !.. I got this weather report ready to send it to Alexa or Pushover message…

“At this moment there is 20 C. For today there will be scattered clouds and a mild weather, with a minimum of 14 C and a maximum of 22 C. Enjoy your day.”

I will be to make the same but for a night report for next day weather …


Would you mind sharing your http string for pulling the today, tonight and tomorrow reports? All I seem to get is “scattered clouds”, “sunny” etc.

Hi my friend. The http call is the same, but the expression has to ask for the correct context value. For tomorrow data I am using:


“1” value is the 2nd array of the context response (tomorrow) and “0” value is the 1st array of the weather context response (weather data), also you can use “description” instead “main” for a deeply data of the weather. I hope this helps !


Hi Friends !
Does anybody knows how to get the day of the week (DOW) from forecast daily “dt” (UTC time stamp) value ?

I know for example that 1646326800: is “Thu Mar 03 2022 17:00:00 GMT+0000”, but I want to get “Thu” to translate to the Spanish “Jue”.


Hi @Carlos_Juarez-
This Custom Tiles tile should automatically display the days of week based on the language code you enter. Are you perhaps referring to the work you were doing in the Rules to Query Open Weather where you are querying the weather with rules?

1 Like

Hi Josh… Oh yes !.. Im referring to the rules to query Open Weather, I think in the wrong post. !

Hi @Carlos_Juarez - I merged the posts into your main Open Weather Rule API thread.

You could use an Expression to format the dt value that you mentioned. The Date Functions and Date Formats help documents might be helpful here. The formatDate() method can be used to format your timestamps to a string to get the day of week:

formatDate(now(), 'ddd', 'es')

So if you have the timestamp in seconds from the Open Weather request in a variable, we just need to convert it into milliseconds by multiplying it by 1000 to be used with the formatDate() function. You could also just reference the $ if desired.

formatDate($myTimestamp * 1000, 'ddd', 'es')
1 Like

Can someone tell me what I have wrong in these 2 expressions querying the OpenWeather API?
They are string variables and return <>