One line weather summary

Home ScreenThe following is the relevant code to get Tasker, AutoLocation, Zooper and Forecast.io to display the one line weather summary on your phone.

It’s possible to not need AutoLocation and use the Tasker lat/lng but I was after testing the application, and you could use a different widget tool like Minimalistic Text, or even just a notification in the status bar.

Step 1:
Sign up to the API at Forecast.io https://developer.forecast.io/register
You don’t need to provide card details as the you get 1000 calls per day, and you shouldn’t get close to using them all (my peak is only 84 calls). At worst it would just stop working for the rest of the day.
Make a note of your API key.

Step 2:
Build this profile in Tasker (note you need your API key from step 1 as !!!!YOURAPIKEY!!!!)

Profile: Update Weather Text (46)
State: AutoLocation Location [ Configuration:Location Report Name: Weather ]
Enter: Weather V2 (28)
A1: Flash [ Text:Getting weather Long:Off ] 
A2: HTTP Get [ Server:Port:https://api.forecast.io Path:forecast/!!!!YOURAPIKEY!!!!/%allatitude,%allongitude Attributes:units=uk Cookies: Timeout:10 Mime Type: Output File: Trust Any Certificate:Off ] 
A3: If [ %HTTPR = 200 ]
A4: JavaScriptlet [ Code:var info = JSON.parse(global("HTTPD"));
flash(info.minutely.summary);
setGlobal("FORESUM", info.minutely.summary); Libraries: Auto Exit:On Timeout (Seconds):45 ] 
A5: Zooper Widget Pro Variable [ Configuration:#TWEATHERTEXT# = %TIME %FORESUM Package:org.zooper.zwpro Name:Zooper Widget Pro Variable Timeout (Seconds):0 ] 
A6: End If 
A7: AutoLocation Location [ Configuration:Stopping Location Monitor
Location Report Name: Weather
Update Type: No Power Package:com.joaomgcd.autolocation Name:AutoLocation Location Timeout (Seconds):0 ]

Step 3:
Build this profile in Tasker

Profile: Display Unlocked (61)
Event: Display Unlocked
Enter: Get Location For Weather (62)
A1: AutoLocation Location [ Configuration:Starting Location Monitor
Location Report Name: Weather
Update Type: Balanced Package:com.joaomgcd.autolocation Name:AutoLocation Location Timeout (Seconds):0 ]

Step 4:
Have a Zooper widget which has a text field with the content #TWEATHERTEXT#

Step 5:
Turn your phone off, wait a few seconds, then turn back on and unlock.
If the Forecast.io call is working you should first see a toast with “Getting Weather”, followed by the one line text.
You can remove these once you are happy everything is working, they are both in Weather V2, the first is at the top, the second is within the Javascriptlet, just delete flash(info.minutely.summary);

13 thoughts on “One line weather summary

  1. Hi,
    Would you mind to post a link to an XML export of this useful profile.
    I did create Both Profiles on my phone, but for any reasons, i cannot get the %FORESUM variable populated…(not using zooper actual, just trying to FLASH the %FORESUM variable…)
    I am afraid the javascriptlet section is the culprit !! (mainly because i do not understand this particular section…)
    thanks.

  2. JavascriptLet should just be
    var info = JSON.parse(global("HTTPD"));
    flash(info.minutely.summary);
    setGlobal("FORESUM", info.minutely.summary);

    spread over three lines in the Code box at the top, don’t touch anything else.

  3. EDIT: Sorry, just look thru the JSON content, and found out that for my actual location: there is no “minutely”…but only “hourly” summary….
    I did the swap in javascriptlet section, then it work fine, now…
    sorry for previous comment…
    bye

  4. Cheers for spotting, it should be possible to put a couple of ifs in to check minutely.summary, then hourly.summary, then daily.summary but I’ve not been anywhere which didn’t report minutely

  5. So, I was having trouble getting %allatitude and %allongitude to populate. I fixed this by changing the task in Step 3 — in the Autolocation Location plugin settings, I checked the box for “Retrieve First Location” and adjusting the Timeout from 0 (none) to 5 seconds. With these changes on my system, this works very well! THANKS for the ideas and tips! The JSON is very useful as now I can retrieve a bunch of different metrics to make a more accurate and detailed weather report.

    The updated Step 3 for me looks like:
    Profile: Display Unlocked (61)
    Event: Display Unlocked
    Enter: Get Location For Weather (62)
    A1: AutoLocation Location [ Configuration:Starting Location Monitor
    Retrieve First Location: true
    Location Report Name: Weather
    Update Type: Balanced Package:com.joaomgcd.autolocation Name:AutoLocation Location Timeout (Seconds):5 ]

  6. Hi Ryan,
    Thanks for the profile. However, I am trying to implement precipProbablity in my weather. I was trying
    flash(precipProbablity.hourly.data);
    setGlobal(“FORESUM”, precipProbablity.hourly.data);

    and this is not giving anything. I must confess I am a java illiterate so not sure what I am doing wrong.
    May you kindly help?

  7. Hi Ryan,
    Can you also kindly help me on getting weather alert?
    I have tried info.alerts.title (and many combination of them :p) without the result

  8. Ryan,
    One last thing! though the forcast.io’s api is working fine, it does not show you warning type (yellow/amber/red). Do you have any thought about it?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Human test: Enter Ryan backwards