In 5 easy steps you'll be able to:
- Get the hourly forecast for your location
- Properly format the forecast times
- Properly format the forecast temperatures
- Create a variable with a correctly formatted forecast
- Create a notification with the forecast
STEP 1 - GET WEATHER
- Add an AutoWeb action
- Use the DarkSky API
- Use the Hourly API action
- Select Output then Fields To Get and select the Time and Temperature fields
- Make sure Coords are set to %LOCN to use your current location
- Set Language to English and choose your units
- Accept and go back to Tasker
- Add a Get Location action with the source Net as the first step in the task to update your location.
- Add a flash action to confirm that the variables are correctly populated
- Run the task and notice how you get times in seconds and temperatures with decimals
STEP 2 - FORMAT TIMES
- Add an AutoTools Time action
- Set Dates to Format to %time()
- Set Format to HH:mm or whatever format you want the times to appear in
- Enable Use Seconds (because the DarkSky API outputs the time in seconds)
- Add an Array Set and set it to overwrite the %time array with the formatted dates from AutoTools (%atformatteddate())
- Accept, go back to Tasker, move the flash action to the last positions and run the task again. Check that the times are now formatted correctly.
STEP 3 - FORMAT TEMPERATURES
- Add an AutoTools Text action
- Set Text to %temperature()
- Set Variable Name to temperature()
- Enable Format Numbers and set Number Format to ##º. This will get rid of the decimals and append º to each temperature
- Accept, go back to Tasker, move the flash action to the last positions and run the task again. Check that the temperatures are now formatted correctly.
STEP 4 - MERGE FORECAST RESULTS
If you have any questions about what was done here please refer to the AutoTools Arrays Guide's Merging Section.
- Add an AutoTools Arrays action
- Set the Input Arrays to %time()|%temperature()
- Enable the Merge Arrays option under the Merge menu
- Set the Merged Array Name to timesandtemps
- Set the Merged Array Joiner to -
- Set the Join Merged Arrays to a single new line character (press Enter on your keyboard)
- Accept, go back to Tasker, move the flash action to the last position, set its text to %timesandtemps and run the task again. Check that you get a list of times and temperatures
STEP 5 - CREATE NOTIFICATION WITH HOURLY FORECAST
- Add a new AutoNotification action
- Set the title to Hourly Weather
- Set the text to %timesandtemps
- (Not In the video) Set the Status Bar Icon Manual value to %temperature1 so that the notification shows the first temperature right in the notification icon
- Go back to Tasker, disable the Flash action and run the Task to make the notification appear
You can now know the time for the next hours very easily!
Show all temperatures for the next hour in a notification (Merge Arrays)
Learn how can merge arrays to easily format hours and temperatures and create a notification
Recent Updates
- Now updated to DarkSky API Sep 26, 2018