IOS Weather Shortcuts are Broken, Here’s How I Fixed Mine

Disclaimer, I don’t consider myself a programmer. At best I am a citizen developer, a term programmers hate. My degree is in accounting and my programming skill level can best be described as “knows enough to be dangerous’.

I’ve been playing with shortcuts in IOS. Mostly I’m building a morning an evening routine to start and wrap up my day. These include things like upcoming calendar events, tasks, today’s weather, etc. That’s how I found out that the weather tools in Shortcuts, and most of the weather shortcut examples suck.

In Shortcuts, users can select Get Current Weather for a location. Then use text or scripting to pull out individual elements like today’s high. This is where things go wrong. The “high” temperature is the high over the LAST 24 hours. If the current temp is higher it doesn’t matter, you get yesterday’s high. I’m not sure how this makes any sense, but it’s what Current Weather does. And many, many weather shortcut examples do exactly this and give wrong information.

There’s a different option in Shortcuts called Get Weather Forecast. That seems promising, until you realize that it gives you the forecast for each of the next 7 days. Most of the time, I’m trying to figure out today. Seven days is forever.

Ultimately, I solved this using scripting in Shortcuts to pull out just one day. For my day start, I look at today. For my day end, I look at tomorrow.

The nuts and bolts of this are:

  1. [Get Weather Forecast] Get Daily forecast at CurrentLocation
  2. [Get Item from List] Get FirstItem from High (High is one choice from the Weather Conditions magic variable. This is a list of high temps over the next 7 days and we are picking the first one, today.)
    [Get Item from List] Get Item at Index 2 from High (Item at Index 2 is the second choice in the list. Today is 1, tomorrow is 2, etc.)
  3. [Round] Round Item from List to Ones Place (This is optional and rounds the temp to the nearest whole value. It’s a prediction not a precise measurement.)
  4. [Set Variable] Set Variable nHigh to Rounded Number (I chose to put the result into a variable because I want the high and low and other pieces to all be displayed together.
  5. [Text] Today’s high will be nHigh (nHigh here is the variable from above. You should be able to just select it. This sets the text to speak or display.
  6. [Show Result] Show Text (Show will show or speak depending on if the shortcut is run from Siri)
    [Speak Text] Speak Text (Speak will always speak the text

I hope this helps somebody out who’s struggling with this. I found it frustrating and I tend to blog about things I don’t want to forget.