Jump to content

Dark Sky Workflow


Jb_Bryant

Recommended Posts

I was using an extension before that would output Dark Sky information. I can't recall where I found this: 

http://d.pr/i/gMsv

 

I was using this applescript:

 

 

# This API key is mine but I'll let you use it for now.
# If this stops working, get your own at
 
KEY="066c528cb69bbf39636b07b83bbcdb4c"
 
# Look up your location at
# Don't use more than 4 decimal points
 
LAT="30.2345"
LON="-81.5642"
 
php -f darksky.php -- "{query}" $KEY $LAT $LON
 
 
 
I'm having issues getting this to work in v. 2. The output is displayed as this: http://d.pr/i/s0TQ. 
 
Is this all set up right? Anyone want to give this a shot?
Link to post
  • Replies 65
  • Created
  • Last Reply

I have it working... at least for the current temperature. Still troubleshooting the "today" & "tomorrow" commands. Typing "darksky" will give current weather conditions.

 

The reason it was not working in your workflow is that you were using Applescript and did not have the darksky.php file inside the folder.

 

Dark Sky (sort of) for Alfred v2 → http://jrhd.me/ME0F

Link to post
It actually shows where you got the script in the first screen shot in the upper right corner. Here is the original...

 

http://hackmake.org/2012/11/dark-sky-alfred-extension

 

I'm playing around with it as well.

 

I thought it was in there somewhere I just didn't notice it at first glance haha

 

I have it working... at least for the current temperature. Still troubleshooting the "today" & "tomorrow" commands. Typing "darksky" will give current weather conditions.

 

The reason it was not working in your workflow is that you were using Applescript and did not have the darksky.php file inside the folder.

 

Dark Sky (sort of) for Alfred v2 → http://jrhd.me/ME0F

 

Thanks! I'll give it a try. I only used darksky anyways.

Link to post
I have it working... at least for the current temperature. Still troubleshooting the "today" & "tomorrow" commands. Typing "darksky" will give current weather conditions.

 

The reason it was not working in your workflow is that you were using Applescript and did not have the darksky.php file inside the folder.

 

Dark Sky (sort of) for Alfred v2 → http://jrhd.me/ME0F

 

Why use "Run Script" vs. "Run AppleScript"? I'm not too savvy with code/scripts.

Link to post
Why use "Run Script" vs. "Run AppleScript"? I'm not too savvy with code/scripts.

 

I'm learning scripting as well. I know enough to get me in trouble. The original script runs as a shell script extension so I just copied the same stuff over. I also spoke with Nick (the creator) and he stated he would update it as soon as he gets Alfred v2.

Link to post
  • 2 months later...

Hi all,

As TychoX mentioned, I finally got a chance to install Alfred 2 over the weekend and updated my Dark Sky workflow. You can download the 2.0 compatible version at http://cl.ly/2y031N34363G.

I'm working on a script filter version of the workflow that puts the output inline like David's Weather workflow. I want to make it better, like setting up latitude and longitude in Alfred rather than the settings, but for now here's the script filter version you can check out: http://cl.ly/0x2n0h1U0C1o

Let me know if you find bugs or if it just plain doesn't work.

Link to post

Hi all,

As TychoX mentioned, I finally got a chance to install Alfred 2 over the weekend and updated my Dark Sky workflow. You can download the 2.0 compatible version at http://cl.ly/2y031N34363G.

I'm working on a script filter version of the workflow that puts the output inline like David's Weather workflow. I want to make it better, like setting up latitude and longitude in Alfred rather than the settings, but for now here's the script filter version you can check out: http://cl.ly/0x2n0h1U0C1o

Let me know if you find bugs or if it just plain doesn't work.

 

Nick, When I ran the workflow it only displayed the forecast for 24 hours on the initial launch. All subsequent launches reveal "Now" and "the next hour"

Link to post

Hey Nick,

 

Just wanted to let you know, I tried the inline version of your workflow, and it looks great!  I like how it shows all the results within Alfred, and I don't mind editing the settings within the workflow itself.  Just one thing, when I use the LAT and LON of say, New York, it displays the results for Now, Next Hour, and Next 24 Hours.  When I use my location in Texas, it's not showing the Next 24 Hours.

 

Any thoughts?  Please keep up all the great work, and thanks again!

Link to post

I did some more testing, and it appears the Next 24 Hour issue only occurs if daySummary returns clear.  If Dark Sky reports something other than clear for daySummary, it seems to work correctly.

 

I tried reviewing the darksky.php so see if I could determine what's going on, but I must admit, my knowledge of programming is woefully lacking. If anyone could help, I'm sure we'd all greatly appreciate it.  Thanks!

Link to post

I've used both of these, as they are both awesome, but unfortunately in both cases I get the same results and the results don't seem to change throughout the day or the location. Here's what I see http://cl.ly/NtAn .

 

It'd be great if this could look like David F's Weather workflow. Maybe with a splash of Forecast.io in it. :)

 

There's definitely a demand for this functionality.

 

Thanks much and looking forward to new versions if they're coming! 

Link to post

Here is something I added to the workflow so that it would find the weather wherever I am. It requires you to download a program called whereami (that accesses corelocation API's). The developer has posted the source on github and has built and signed the binary so that it works on Mountain Lion.

 

http://robmathers.github.com/WhereAmI/

 

(To Note: Place it in /Applications)

 

add this line into the bash script to replace LAT LON in the workflow.

 

read LAT LON <<< `/Applications/whereami | awk '/Latitude:|Longitude:/ { printf "%0.4f ", $2 }'`
Link to post

Here is something I added to the workflow so that it would find the weather wherever I am. It requires you to download a program called whereami (that accesses corelocation API's). The developer has posted the source on github and has built and signed the binary so that it works on Mountain Lion.

 

http://robmathers.github.com/WhereAmI/

 

(To Note: Place it in /Applications)

 

add this line into the bash script to replace LAT LON in the workflow.

 

read LAT LON <<< `/Applications/whereami | awk '/Latitude:|Longitude:/ { printf "%0.4f ", $2 }'`

 

This doesn't work for me. Shows me what @Nick is getting. The one that @nickwynja posted works great for me. Not sure why I can't get whereami to detect my location. Maybe you left out some sort of set up instructions?

Link to post

Hmm. my workflow script looks like this. The only thing that is different is I am using my own API key.

# This API key is mine but I'll let you use it for now.
# If this stops working, get your own at
# https://developer.darkskyapp.com/register

KEY="<using my own API key>"

# Look up your location at
# http://stevemorse.org/jcal/latlon.php
# Don't use more than 4 decimal points

read LAT LON <<< `/Applications/whereami | awk '/Latitude:|Longitude:/ { printf "%0.4f ", $2 }'`

# Set METRIC to true to return temperature in celcius. Otherwise returns in fahrenheit

METRIC="false"

php -f darksky.php -- "{query}" $KEY $LAT $LON $METRIC
Link to post

Hmm. my workflow script looks like this. The only thing that is different is I am using my own API key.

# This API key is mine but I'll let you use it for now.
# If this stops working, get your own at
# https://developer.darkskyapp.com/register

KEY="<using my own API key>"

# Look up your location at
# http://stevemorse.org/jcal/latlon.php
# Don't use more than 4 decimal points

read LAT LON <<< `/Applications/whereami | awk '/Latitude:|Longitude:/ { printf "%0.4f ", $2 }'`

# Set METRIC to true to return temperature in celcius. Otherwise returns in fahrenheit

METRIC="false"

php -f darksky.php -- "{query}" $KEY $LAT $LON $METRIC

 

Ya I don't know what I did wrong but it's working now. Thanks!

Link to post

Just my opinion regarding this workflow..

 

Thanks for the note about getting your own API key. That's definitely helpful.

 

I'm not keen on installing anything that does something else. I realise it's a legit app, it just seems like it's a bit much when just plugging in my Long and Lat should do the job.

 

Unfortunately, I've done that for my office, my home and the nearest huge city and sadly, I get no results sent back to me.  

 

Maybe the new API key takes a bit to get running.  

 

Still love this, hoping it works in the end.

 

Thanks very much!

Link to post

FWIW, I just started getting {"403":"Forbidden"} with my new API key. I am taking a wild guess that any new API key signups don't have access to the v1 version of the Dark Sky API as it seems they have just pushed the v2 version of the API. Being that they just released forecast.io, its quite plausible.

 

As far as installing another app I agree, its not a very clean solution. I am going to look at using javascript to get alfred to trigger the Location Services API via Safari or some such method.

 

If I have a little more time today I will fork darksky.php and update it to use the v2 API.

Link to post

FWIW, I just started getting {"403":"Forbidden"} with my new API key. I am taking a wild guess that any new API key signups don't have access to the v1 version of the Dark Sky API as it seems they have just pushed the v2 version of the API. Being that they just released forecast.io, its quite plausible.

 

As far as installing another app I agree, its not a very clean solution. I am going to look at using javascript to get alfred to trigger the Location Services API via Safari or some such method.

 

If I have a little more time today I will fork darksky.php and update it to use the v2 API.

 

 

It's a good workaround for some users as I bet a lot of people suffer trying to find the right Long / Lat.
 
I reckon a lot of people either don't know how to get their Long / Lat or they just can't make the adjustments in the script. 
 
It's great you provided a work around for users who need it. I think that if you have multiple locations and you can detect your location through that service, so that it can vary, that's very valuable. 
 
To date, I use my work location and bypass my home. Fortunately they're near enough that it's not *really* an issue for me.
 
I'm following this thread and can't wait to see next steps. I had a quick post on one of David Ferguson's workflows, I think, he's looking to move his workflow to Dark Sky in the near future so it might be worth getting in touch with him. His blog is here: http://dferg.us/ and I reckon you can find the workflow there as well.
 
Also, thanks very much for opting to get involved and do this. I'm not a coder, I fail miserably at it, but I definitely appreciate those who can and do, often for free. :) 
Link to post

For those who are watching.

 

I modified the darksky.php script to support the latest forecast.io API. I didn't fork Nick Wynja's version on github as it isn't the most recent Alfred 2 version.

 

To get my modified version of the script, go here: https://www.box.com/s/xct1160ftcjlekaa7qqc

 

To replace the version that exists in the current plugin, double click on the Run Script icon in the workflow editor, find open workflow folder and drag and drop the script into the list view (remember to click replace).

 

Again, if you wish to use this I would suggest grabbing your own API key.

 

Feel free to do whatever you wish with this.

Link to post

For those who are watching.

 

I modified the darksky.php script to support the latest forecast.io API. I didn't fork Nick Wynja's version on github as it isn't the most recent Alfred 2 version.

 

To get my modified version of the script, go here: https://www.box.com/s/xct1160ftcjlekaa7qqc

 

To replace the version that exists in the current plugin, double click on the Run Script icon in the workflow editor, find open workflow folder and drag and drop the script into the list view (remember to click replace).

 

Again, if you wish to use this I would suggest grabbing your own API key.

 

Feel free to do whatever you wish with this.

 

The modified script doesn't work for me. Just sits here: http://cl.ly/image/0t1g2N3w2W1F

 

Worked perfect when I reverted back to the old PHP file.

Link to post

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...