STEP 1 - AUTOWEB WEATHER UNDERGROUND API AUTHENTICATION
If you accidentally hit cancel, ok, or just back out and cannot return to the screen, the next step will show you how to get to it.
- Open AutoWeb and select Browse Web Services
- Search for Weather Underground and select Import API
- Wait for the toast stating Weather Underground Imported and wait for the pop-up with instructions on how to obtain a secret key
- If you already have a secret key handy enter it at the bottom, if not follow the instructions provided
STEP 2 - ENTERING YOUR SECRET KEY
Once this is complete, you will be able to access the API endpoints within Tasker.
- Select Your Web Services
- Long press on Weather Underground and select Edit API Config
- Locate the Secret Key field and enter the secret key you've obtained from the previous step
- Select OK and you will see a message stating API Updated and the text Ready To Use underneath the API on the main screen
STEP 3 - NEW DAY TIME CONTEXT
Entering the time as "00:00" in both fields makes the task run at midnight, every night. This task can also be used to run maintenance actions that need to happen every day.
- Open Tasker and add a new Profile titled New Day
- Make sure the From and To boxes are checked
- enter 00:00 for both sections
STEP 4 - RETRIEVE SUNRISE AND SUNSET TIMES BY LOCATION
This AutoWeb API action will provide the sunrise hour, sunrise minute, sunset hour, and sunset minute. The tasker global variable %LOCN was used to retrieve this aforementioned times based on your current location
- Add an AutoWeb Action
- Select the Weather Underground API and the Astronomy action
- Select Output, then Select All, and back out
- Select Language and select the appropriate Language
- Select Query and enter %LOCN (without the quotation marks)
STEP 5 - CREATING SUNRISE AND SUNSET GLOBAL VARIABLES
This step will set the sunrise and sunset times to global variables to be able to use in other projects and profiles.
- Add a Variable Set action
- Enter %SUNSET in the Name field
- Enter %sunsethour:%sunsetminute in the To field using the tag icon
- Add another Variable Set action
- Enter %SUNRISE in the Name field
- Enter %sunrisehour:%sunriseminute in the To field using the tag icon
STEP 6 - SUNRISE AND SUNSET CONFIRMATION NOTIFICATION
This is just a confirmation notification to show the user that these sunset and sunrise times were set. If performed correctly, the notification in step 7 below should appear.
- Add an AutoNotification Action
- Fill in the values as shown in the photo above
STEP 7 - FINAL USER NOTIFICATION
The final product will produce a notification like the one here.
STEP 8 - NIGHT PROFILE
This profile will run from the sunset time until the sunrise time (overnight). We will now add an entry AND exit task.
- From the main screen add another profile title Night with a time context
- Make sure the From and To boxes are checked
- Enter %SUNSET in the From field
- Enter %SUNRISE in the To field
STEP 9 - ENTRY TASK
This is just a placeholder notification to run when the sunset time is matched. You can place anything you want here instead of the notification as this will run at sunset.
- Add an entry task containing an AutoNotification Action
- Fill in the values as shown in the photo above
STEP 10 - EXIT TASK
This is just a placeholder notification to run when the sunrise time is matched. You can place anything you want here instead of the notification as this will run at sunrise.
- Add an exit task containing an AutoNotification Action
- Fill in the values as shown in the photo above
STEP 11 - SUNSET AND SUNRISE NOTIFICATIONS
The final product will produce a notification upon sunset and another upon sunrise like the ones here.
Day/Night Project based on Sunrise and Sunset Times 1.0
Do anything at Sunrise or Sunset based on your location