Dark Sky automation question

Of course! Post again if you get stuck

As a fellow cyclist, I appreciate your objective!

On a related note, I have a half finished shortcut/scriptable app that takes GPX track data from a planned route and produces weather at location every 30 minutes based on a planned start time and a projected average speed. This was motivated by the day we’ve all add when the weather looked great and I got about an hour in and the heavens opened up on me!

It mostly works. I need to carve out some time to get it finished. I think it would be really useful. Would be a great add-in to apps like Ride with GPS or EasyRoute.

That’s great! What a good idea. My wife and I are just getting started in recreational biking. We need the exercise. Plan on hitting the paved bike trails that run throughout Ohio.

I did put on my API key for Dark Sky and ran the script framework you gave just to try it out (without conditions, loops, etc.)

I got the following error (see the pic). Any ideas?

Just to be sure, in the dark sky URL, when you put in your API key, you removed the square brackets, too?

The URL should look something like this:

https://api.darksky.net/forecast/c123123121231212312/Lat,Lon

If you did do that, I suggest adding a QuickLook action immediately after the Get Contents of URL action. You should see a return payload of data or perhaps an error message. Try that and report back.

1 Like

After I put in the Quick Look as you suggested I saw this error.

I have location services turned on an it gives permission for Shorcuts app

Suggestions?

My url I the following

https://api.darksky.net/forecast/(MyKey)/Current Location (Latitude),Current Location (Longitude

(MyKey) is replaced by my key

The URL should look like this. No other characters eg, no “(“

Is this the construct you are using?

https://api.darksky.net/forecast/c123123121231212312/36.1111111,-86.2222222

I suggest adding a quick look action right after the URL action to make sure the URL is being formed correctly.

Edit:
This is what Quick Look displays when inserted immediately after the URL step. Your URL should look similar in construct.

Ok so I’m assuming there is a a way for me to automatically get the current lat, long using another function within Shortcuts. I want it to look at weather wherever I currently am located.

Yes, there is… Get Current Location. See the original shortcut example I linked to above. That Shortcut includes that action and demonstrates how you reference its values in the Dark Sky URL.

1 Like

The problem is get current location actually returns an address and not the latitude and longitude. I have to use get location details apparently

You should be able to use the Get Details of Location to pass you long/lat values that you can plug into the api.

1 Like

If you look at the original shortcut example I posted, it shows how to reference the lat and long from the Get Current Location action. You should be able to use that exact shortcut, only putting in your API key.

Edit:
here’s a simple screen capture that demonstrates how to access the attributes of the Get Current Location action. I hope this helps clarify

2 Likes

Ok. I Apologize for all the questions. I guess I wish there was better documentation on how to use this stuff. Granted it’s still pretty new. Thank you again.

Sometimes the documentation is hidden, and other times you write your own. In this case, it’s both.

They can’t write documentation to fit all scenarios. However, they do write documentation for each individual component. Tapping the info icon before you add it to your Shortcuts shows what the component does and accepts as input and what it outputs. Once added to the Shortcut, you can bring that back up by tapping on the icon for the component.

Sometimes, it’s easier to write the documentation for what you want to achieve on paper then go searching for the proper pieces to fit what you’ve outlined.

Seems like you’re doing great though. Keep it up!

Have you tried using the built in weather functions? These were significant enhanced in version 2.1 as we mentioned on the podcast recently.

https://www.icloud.com/shortcuts/8352d72d440e47c5bf8bbf30592426a2

2 Likes

That would certainly be a simpler start, IF the future forecast included wind speed. Unfortunately, the new capability does not include that attribute in the forecast data. At least in my experiments

Thank you all for your responses! Very helpful! Rosemary, how ironic you responded to this because I was just listening to your interview on the day one podcast.

I have wind speed here :wink:
It’s in my example :slight_smile:

1 Like

Interesting. Not in my locale!

To be sure, the elements are in the shortcut action. However, no data is returned for that field in my location.

1 Like

Maybe that’s why your OCR doesn’t work? :wink: :joy:

By George, that’s it! Touché