Tasker: Alarm clock, improved

One handy little app that I’ve found is Night Clock for those nights away from home and no alarm clock around.  However, I’ve always found that all night or alarm clock apps for Android are way too bright and act light a giant night light shining in my eyes.  So, I built a very simple Tasker profile to automatically dim the screen and turn off button lights.

Description

I built a set of three tasks:

  1. Display Night Mode – turn the display to a special “Night mode” not regulated by the phone’s brightness sensor
  2. Display On – Set the display timeout to 9 hours so it stays on
  3. Display Normal – return the display to normal brightness sensor, timeout and other normal settings

Now with these fairly generic tasks, I can setup multiple profiles to change the screen’s settings.

Profiles

The following is a text description of the profiles contained in this project.  This is simply here to help explain what each of the profiles is for, what it does, and why.  The profiles themselves can be imported directly into Tasker at the bottom of this article.

Profiles #2, #3 & #4 aren’t part of this particular article, but I thought I would share descriptions and XML of other times when I use the “Display Night Mode”, “Display Normal” and “Display On” tasks.

  1. Dim Screen Alarm App
    1. Contexts:
      1. App opened: Night Clock
    2. Tasks:
      1. |> Display Night Mode
      2. <| Display Normal
  2. Dim Screen At Night Summer
    1. Contexts:
      1. Docked: Car
      2. From 20:00 Till 06:00 – from 8 PM until 6 AM
      3. Apr, May, Jun, Jul, Aug or Sep
    2. Tasks:
      1. |> Display Night Mode
      2. <| Display Normal
  3. Dim Screen At Night Winter
    1. Contexts:
      1. Docked: Car
      2. From 18:00 Till 06:00 – from 6 PM until 6 AM
      3. Jan, Feb, Mar, Oct, Nov or Dec
    2. Tasks:
      1. |> Display Night Mode
      2. <| Display Normal
  4. Browser Screen On
    1. Contexts:
      1. App opened: Browser, Firefox or ScoreCenter
    2. Tasks:
      1. |> Display On
      2. <| Display Normal

Tasks

The following are text descriptions of the different tasks associated with this project, again for explanations of what they do, not for creating them manually.  Import the project below and all of these tasks will be imported for you.

Task #3 is not part of this article, but I thought I would share it’s description and XML as well.  I use it for other profiles like “Browser screen on”, and it’s exit task is “Display Normal” as well.

  1. Display Night Mode – switches the display to a special night mode that ignores the brightness sensor
    1. Night Mode: On
    2. Car Mode: On IF %PACTIVE ~ *,Dim Screen At Night* – If car night profile, set car mode on
    3. Auto Brightness: Off
    4. IF %PACTIVE ~ *,Dim Screen Alarm App,* – if the Alarm App profile is what called us:
      1. Display Brightness=2 – set the brightness SUPER bright, nearly off
      2. Set Light: button-backlight=0 – turn off the button backlights (the hard-buttons for home, menu, etc)
    5. ELSE – for all other profiles that call this:
      1. Display Brightness=10 – darker than normal, but still fairly visible
      2. Wait 2 minutes
      3. Goto Action #1 IF %PACTIVE ~ *,Dim Screen At Night* – if either “Dim Screen At Night …” profile is active, continue running this task, repeating every 2 minutes, to allow us to reset the brightness if the navigation app turns the brightness back up
    6. END IF
  2. Display Normal – reset the display settings back to normal
    1. Set Light: button-backlight=1 – if the button backlights were disabled, enable them again
    2. Display Timeout: 45 seconds – if the display timeout was changed, reset it
    3. Auto Brightness: On
    4. Car Mode: Off
    5. Night Mode: Off
  3. Display On – force the screen to stay on instead of continually timing out and going to sleep
    1. Display Timeout: 9 hours

XML to import

The following XML file can be imported directly into Tasker.  It will create a new tab (Project) where all of the profiles and tasks will be stored, and will import all of the necessary profiles, tasks and variables for it to work.  You may need to tweak a few settings, but it will handle the majority of the setup for you.

Note: you must disabled “Beginner mode” in order to be able to import this configuration.

Dim_Screen_Alarm_app.prf