Jump to content
kejadlen

Yet Another Weather Workflow

Recommended Posts

I couldn't find any forecast workflows that were quite to my liking, so I whipped one up that gets a forecast from forecast.io:

 

eTuONUQ.png

 

Note: requires at least Mavericks. Not tested on Yosemite.

 

Download: https://github.com/kejadlen/dark-sky.alfredworkflow/releases

GitHub: https://github.com/kejadlen/dark-sky.alfredworkflow

Edited by kejadlen
Updating to Dark Sky

Share this post


Link to post

@kejadlen

 

Its working at 99.9 % on Yosemite 10.10.1

 

The install instructions and getting the API keys all were very well written. No issues at all getting it setup in less than 5 minutes. I obviously compared it with other weather services to see if the correct data was being returned. Using the 2 locations, I am currently working at, it functions very well. The correct data and locations are displayed. 

 

The only issue, I saw and its minor in my opinion. If you type in a location and press enter it will take you to a web page. That page is not loading for me in the Aviator, Safari, Chrome, or Opera browsers.  It is however opening correctly in FireFox. 

 

So I was wondering ?  If its something that can be fixed. If not, its no huge deal for me. I just set up a rule in Choosy (browser chooser) to process the URL and send it to Firefox every time. ;)

 

Nice addition to my collection. 

 

 

ps. I said 99.9 % due to Safari is installed with all Macs and Firefox is an additional download. Also having said that most of us know how flakey Safari can be at times. Hence the reason for keeping multiple browsers around.  

Edited by thightower

Share this post


Link to post

@thightower That behavior is really fascinating! The URL should be ""http://forecast.io/#/f/47.6062%2C-122.3321". This might be an Alfred bug, since the comma character should be unescaped within a fragment. (Although it looks like Firefox correctly handles this case anyway!)

Share this post


Link to post

Can you describe what you're doing and what happens?

 

On entering "forecast" into Alfred, it should use your IP to do geolocation (using ipinfo.io) and automatically pull the weather for that location. The Google API is only used if you enter "forecast" with a location, like "forecast NYC".

Share this post


Link to post

hmm now it works... before there was no location found, just "," and when I clicked on the link I saw it was weather for new york...

 

Now I get Vienna correctly... will test some more tomorrow, not sure why it suddenly workd...

 

thank you for clarification regarding google key

Share this post


Link to post

Great workflow. Love the forecast details.

 

Unfortunately it doesn't work so smoothly for me because I connect to the Internet via a VPN. The workflow gives me the weather for the location of the VPN endpoint, not where I actually am (obviously).

 

It'd be great if I could set a default location (my computer doesn't move) instead of having to enter the location by hand each time.

Share this post


Link to post

Ironically enough, that functionality was taken out when I added IP geolocation. I'm planning on re-adding it, but in the meantime, you should be able to download 0.0.6 and use that instead with setting DEFAULT_LAT_LONG (ex: 13.23,-12.45) and DEFAULT_LOCATION (just used for the name of the location). Pretty much nothing else has changed between 0.0.7 and 0.0.6, so you won't be missing anything else (aside from a minor bugfix for opening the website in the browser).

Share this post


Link to post

Thanks for the tip. As I'm not interested in the geolocation, I just replaced Location.from_ip with Location.new(…) for my city instead. It seemed the simplest solution.

Share this post


Link to post

Now I have problems again, location is not found:

 

Screen%20Shot%202015-05-31%20at%2019.14.

 

When I select it, it takes me to New York....

 

So yesterday it worked, now this issue I experienced in the start is coming again... maybe it cannot determine my location for some valid reason?

Share this post


Link to post

Fiddlesticks.

 

If, like me, you don't move around much, you could hardcode your location instead. It's a hack, but it'll get you your damn fine weather forecast for the right place until there's a non-hacky solution.
 
You could change line 49 of forecast.rb from: 

location = (query.empty?) ? Location.from_ip : Location.new(query)

 to: 

location = (query.empty?) ? Location.new("Wien", 48.2, 16.366667) : Location.new(query) 

Then if you don't specify a location, it will default to Vienna instead of an IP address-based location.

 

AFAIK, you can use "Wien" or "Vienna" or "Home" or "Daheim" or whatever for the first argument. Perhaps @kejadlen can clarify if that's actually okay or if I'm talking nonsense?

 

Also: lol @ "City: Austria" :D

Edited by deanishe

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...