Weather Tile - Open Weather - Current and Forecast

Every 3 hours by default.

You could modify the number set at the very top of your Custom Tile code if you wanted a faster refresh. Just keep in mind that a faster refresh could put you over your API limits.

image

Doing a quick “back of the napkin” math, even with the lower 1000 free API calls for the 3.0 version of the Open Weather API, if you had it set to every 10 minutes, that would be 144 calls per displayed tile in a day

(24 × 60) ÷ 10 = 144

So if you had a single weather tile on 5 different displays, that would be 720 API calls to the One Weather API each day.

Of course, that assumes you aren’t using the API key elsewhere (like in a Hubitat driver) that would be increasing the API call, but you get the idea.

Edit: And if you enable AQI in the tile settings, that requires a separate API call, so it would double the number of API calls.

Thank you for the quick reply.

I only have the weather on my main display so I decided to try 5 minute updates. Which should work out to 288 calls (24*60/5) with no air quality display. So, at line 12, REFRESH_INTERVAL =5*60*1000; //5 minute in ms

I’ll let you know if I have any issues.

Thanks again.

Don’t know what happened with the formatting. That should be 288 calls (24x60/5) and refresh of 5x60x1000.

1 Like

I edited the post for you to fix the formatting. Wrapping text in single asterisks turns it into italics.

If you want to format text as raw/code, you can highlight it and then tap the </> button on the editor toolbar to format it accordingly.

I see you were responding via email, you you can also do it by wrapping your formatted string in backticks:

`your * formula * or code`

Becomes :point_down:

your * formula * or code

Okay, thanks for all that.
In a previous post you stated I’m tempted to drop the H/L value from the current day when not using the ‘OneCall’ endpoint as I think the indicator could be confusing – thoughts?
Don’t think you had any responses to that, however, I agree it is confusing. Is there a way to drop that?

I just pushed an update to the tile to address this. Try updating your custom tile and let me know if it works better:

There’s a few changes in this release:

  • Current Day High/Low Improvements:
    I’ve added in a fallback to Open Meteo which is another free weather source which has a ‘forecast’ for the current day. (Only applies when using the “2.5 Multi” setting)
  • Configurable Refresh Interval
    There’s now a configurable refresh interval setting in the tile rather than you having to edit the interval manually
  • Fixed High/Low “2.5 Multi” Forecast Issues
    This was impacting both the ‘today’ forecast as well as the weekly forecast wherein values over 100 were causing the high/low values to be invalid

Current Day High/Low Improvements:
This appears to work. I see different values depending on what weather service provider I look at for the forecast, but the tile numbers appear to be in the range. Will monitor and let you know if there are any issues.
Configurable Refresh Interval:
This is a nice feature. I entered a refresh rate of 5 minutes which I think is reasonable for my application (see previous discussion above), however I got a warning banner (refresh interval faster than 10 minutes is not recommended) coming up. It continues to come up every time that dashboard is loaded which is annoying, so I put it to 10 minutes. I can live with 10 but would prefer 5 as it then closely matches our local temperature display and then I don’t have to field questions about why they don’t match and get into explanations of polling rates, etc.

Most weather services have a minimum refresh interval, so going beyond that won’t improve anything as its still returning the same data during that interval.

In the case of the Open Weather Map API, the data is refreshed every 10 minutes at best.

“First, we recommend making API calls no more than once in 10 minutes for each location, whether you call it by city name, geographical coordinates or by zip code. The update frequency of the OpenWeather model is not higher than once in 10 minutes.”

Okay, 10 it is then. Everything else looks good. I appreciate the modifications.

1 Like

Current Day High/Low Temperature looks good. Is it possible to add Relative Humidity (RH%) to Current Day?

Yes, I suspect it’s possible.

I’m not sure where the most appropriate place to display it would be though as the ‘today’ section is already getting cluttered and it would definitely need to be optional. Taking a look at screenshots of several popular weather apps, it doesn’t looks like humidity is commonly included, so there’s not a good rule of thumb to go by either.

image

The sample you are showing looks good. Not sure what’s involved in adding that, and it’s in the “nice to have” category, but if it’s not too much effort, I think it would be a good addition.

How can i edit the code to only show current weather and NO FORECAST please advise and thanks all
Thanks all appreciate the support

1 Like

I was able to get this by deleting lines 91-102 in the custom tile.

I do not have the skills to edit it any further.

Hi, this is amazing,

simple to follow and got it working.

I have one question.

Ive been able to remove the gradient - but i want the tile to match the rest of my dashboard ( like the picture attached)

I can see how to turn the color magnolia but can see how to change the font color to grey - either by changing the font color in the tile editor or by searching in the original code thingy you posted - but if im being honest I have no idea what im looking for :slight_smile:

any advice?

many thanks
Tom

I’m no expert but you can set the font color by specifying it on line 108. Something like the below. You should also be able to set it via hex code like #808080

html, body { height: 100%; margin: 0; font-size: 5vh; color: white }

I pushed a number of neat updates to the Open Weather custom tile this evening:

  • Several new ‘templates’ with various layouts:
    • Default
    • Today
    • Today (Wide)
    • Today (Mini)
    • Forecast
    • Forecast (Horizontal)
  • Toggle the Default Background Gradient
  • Added several attributes to some of the new layouts
    • Humidity
    • Wind Speed
    • Percent Chance of Precipitation
    • Sunset and Sunrise Times
  • Fix for certain edge-case browsers with minor layout glitches
    • Chrome 57-59 and Safari 10.x
  • Fixed font size on 2.5 Multi API
    • The 2.5 Multi API only returns 4 forecast days vs 6 from others
    • Increased the font size to take advantage of the extra space

You can use the Update from Source option to update your tile.

Today

Today (Wide)

Today (Mini)

Forecast

Forecast (Horizontal)

5 Likes

Josh, thanks for all your great work.

On the weather tile I am using 3.0 onecall and in format Today (Wide) but both the sunset and sunrise are the same time and they are both wrong. 9:52 AM
Not sure if my screenshot worked?
Thanks for your help

1 Like

If I switch to 2-5 multi, sunrise and sunset appear to be correct. Just not correct on 2-0 OneCall or 3-0 OneCall.
Also the city name top left appears on 2-5 multi but not 2-0 OneCall or 3-0 OneCall. Data is slightly different when I switch between 2-5 multi and 3-0 OneCall.
I am not sure if the data will update properly if I leave it on 2-5 multi because my api key is 3-0 OneCall?
Thanks

I just pushed an update which should resolve this. Thanks for reporting! :slight_smile:

That’s expected. The city name is only provided with the 2.5 Multi APIs. OpenWeather’s OneCall APIs don’t include the city information.

OpenWeather has a separate dedicated Reverse Geocoding API that I could use to add this information to the OneCall versions though. If there’s enough interest in it, I could add it.

I didn’t want to make one more API call that could increase the consumption of everyone’s API Keys, but I could probably cache and re-use the result as it’s not something that’s likely to change. :wink:

The OneCall APIs are generally preferred from a data quality perspective. The 2.5 Multi option is used as the default since everyone has access to it. This was discussed further up in the thread (1, 2). To summarize:

The 2.5 Multi approach:

  • Uses separate Current Weather and 5 day / 3 Hour Forecast APIs
  • The daily forecast values are aggregated from their 3 hour subcomponents
  • The high/low for the current day is missing, so it queries Open Meteo for this data

In other words, the OneCall versions are directly returning the daily forecasts and the current day’s high/low temperature. And the forecast is for 7 days instead of 5.

2 Likes