Day/Night Project based on Sunrise and Sunset Times 1.0

Do anything at Sunrise or Sunset based on your location

  1. Rory_Harnisch

    STEP 1 - AUTOWEB WEATHER UNDERGROUND API AUTHENTICATION


    • 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
    [​IMG] 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.


    STEP 2 - ENTERING YOUR SECRET KEY


    • 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
    [​IMG] Once this is complete, you will be able to access the API endpoints within Tasker.


    STEP 3 - NEW DAY TIME CONTEXT


    • 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
    (i) 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.


    STEP 4 - RETRIEVE SUNRISE AND SUNSET TIMES BY 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)
    (i) 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


    STEP 5 - CREATING SUNRISE AND SUNSET GLOBAL VARIABLES


    • 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
    (i) This step will set the sunrise and sunset times to global variables to be able to use in other projects and profiles.


    STEP 6 - SUNRISE AND SUNSET CONFIRMATION NOTIFICATION


    • Add an AutoNotification Action
    • Fill in the values as shown in the photo above
    (i) 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.


    STEP 7 - FINAL USER NOTIFICATION


    (i) The final product will produce a notification like the one here.


    STEP 8 - NIGHT PROFILE


    • 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
    (i) This profile will run from the sunset time until the sunrise time (overnight). We will now add an entry AND exit task.


    STEP 9 - ENTRY TASK


    • Add an entry task containing an AutoNotification Action
    • Fill in the values as shown in the photo above
    (i) 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.


    STEP 10 - EXIT TASK


    • Add an exit task containing an AutoNotification Action
    • Fill in the values as shown in the photo above
    (i) 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.


    STEP 11 - SUNSET AND SUNRISE NOTIFICATIONS


    (i) The final product will produce a notification upon sunset and another upon sunrise like the ones here.

Recent Reviews

  1. aabaud
    aabaud
    5/5,
    Version: 1.0
    Wow. Another great autoapp. amazing