Gets and Speaks Weather for Current Location in Morning

Download Profile

This task creates a profile initially based on the Speak Weather in the Morning, though it's been changed substantially since that point. There are no accounts or signups required for this task, should work immediately once you load it.

Task Overview

This profile finds your current GPS location and gets the weather for wherever you are.

It then parses the first two time periods of the weather data that the HTTP get receives, get and parses the location of the data.

Finally, it checks to see what volume level or silent mode your phone was previously in, turns the volume up and silent mode off, reads the current date, time, location and weather to you, and returns your phone to its previous silent/volume level state.

Also, before pulling weather data the task initializes the %WEATHER and %WEATHER1 variables to "Weather Data Not Retrieved" so if for some reason the weather data does not come (e.g. connection problem of some kind) this notice will be read out to you instead of just silence so you know what happened.

The profile is currently set to run around 7:10 in the morning but you can set it to trigger at any time or off any event you like.

Note: In its current setup this profile turns your GPS off at the end regardless of whether it was on at the start. If this is a problem for you, you can remove this step (Currently step 3 in the Entry task).
Warning: The profile currently turns silent mode off and your volume all the way up and speaks. I did this since for me at 7 in the morning there's never a reason I wouldn't want it speaking, but if you want to be able to prevent it from speaking by silencing your phone, remove the steps on the Exit task that change sound settings on your phone.

Changes you'll need to make:

  1. Step 6 in the exit task is currently set to say "Good Morning, Tom…." followed by the other text. If you want your phone to speak to you you'll need to change this name.
  2. Step 6 is currently set to my default speak engine. You may need to update this (use magnifying glass next to "Engine:Voice" option) to work on your phone's voice engine.
  3. The current setup turns off silent mode and your volume all the way up before speaking. If you want to change the volume of the readout you'll want to do it in step 5 of the exit task. The profile returns your phone to whatever sound settings you were using previously when the profile is done.

Useful Info:

To get this profile do the following:

  1. Use the download link at the top of the page to save the file locally. (you might need to right-click save as to save it rather than view it)
  2. Move it to your phone (if you didn't download it there).
  3. Open up tasker, use the Preferences button and go to "Profile Data".
  4. Choose "Import One Profile." Locate the file on your phone (use back button to go up one level if need be) and choose it.
  5. At this point the profile should now be imported into your phone. Make the above mentioned changes, reset the time or trigger to your preference, and you're set!

Note: It's the exit time, not the entry time, that determines when the speaking starts. I just set the entry time a few minutes earlier to make sure there is time to acquire a GPS location and then get the weather data before it starts speaking.

Alternative Suggestion: If you create a task that calls the two tasks in this profile sequentially then you can add a shortcut to your home screen that gets the weather and reads it out to you. A nice addon.

If you have questions or comments find me at "tms28741-tasker" at yahoo.

Unnecessary Details

I wanted to note some of the further details for advanced users and tweakers but unless you intend to actually get into some of the data parsing or expand on the profile this section isn't relevant for you.

The Weather Data Parsing Process

The pull from wunderground using their API actually has information for several time periods (I think 5 of them). The name of each period is not standard though (i.e. sometimes period 1 is "Today" and sometimes it's "Rest of Today") so I parse time periods by the numeric period. I then further parse periods 1 and 2 to pull out the title and the forecast. Finally I put some standard text along with the title and forecast into two final variables, "Weather" and "Weather2". Afterwards a second pull of the weather server is done and following parsing to identify the current location of the weather pull. Then just to be clean I empty all the HTTPD variables that were used in the intermediate calculations. I haven't found a way to delete them rather than empty them, if anyone has recommendations please email.

The Weather Pull

The data pull itself is done using GPS coordinates, an example of which using the coordinates of the Washington Monument is here. If you want further information on pull options and results you can find it at, the Wunderground wiki for their API.

The Exit Task (speaking without killing your phone settings)
  • The exit task looks more complicated than it is. There are several checks done. First, a check is done to see if your phone was in silent mode. If silent mode was on then the %SILENTPREVIOUS variable is set to 2, if it was on vibrate the variable is set to 1 (if neither then original initialization of variable to 0 is left). Finally the %PREVVOLUME variable records the previous system volume value.
  • At this point then silent mode is turned off, volume turned up and the phone speaks.
  • After speaking the last few steps return the system volume to the previously set level and returns silent mode to either vibrate or on to match the state the phone was in before this profile.

As noted above, this returns your phone to previous settings when done but in this setup it speaks regardless of previous sound settings. If you only want it to speak when your phone is not silenced you'll want to remove the steps that mess with your system sound settings.

Possible Improvements

Change time readout format
Because tasker's time variable, when combined with the voice readout, reads things as "seven point oh six" rather than "seven oh six" I added hours to make it make a little more sense. It might be worth doing some work in the future to parse the time a bit and make that read out a proper time.

Improve Speed
The getting data and parsing it seems to take a fairly long time, which is annoying when you've made a home screen icon to execute the sequential tasks on demand. I'd like to know what I can do to speed that up, may lead to further research in the future.

Add other info to the readout
Of course other possible improvements would be to add more detail which could include horoscope data, sunset times, current news headline, or, if I could link it to wikinvest or potentially portfolio or financial data as well, which would be awesome. Further research on that may result in future updates, and if you have any suggestions or comments please use the above referenced address to share them with me.

Add location name to the readout
A next possible improvement I've considered is to make it speak the weather for the current location but also the name as well. Unfortunately the current wunderground download does not include the location name. I've considered using the Google Maps API or the Bing Maps API for reverse geocoding to get a name and alternatively the wunderground Geo Lookup function might provide the best way to expand that functionality since it would ensure that the location named was in fact the one used for the weather data. So far though I just haven't gotten around to adding this. - Followup: I've since added this, the current profile now includes location identification and readout. I haven't found a way to convert state abbreviations to full state names yet though so it currently just reads "VA" instead of "Virginia" in the location.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License