Automating wakeups with Tasker

Automate your wakeups

Ever watched a movie set in the future, where the protagonist wakes up and the blinds in the room go up, the music starts gently and coffee is automatically served?

Well, the future is now!

This guide goes through how you can trigger this using any alarm application on Android via Tasker, so no additional app (except Tasker which runs in the background), or other hassle to deal with!

This post is also available in blog-form here: Gentler wakeups with Home Assistant 🥱 .

Home Assistant

The movies set in the future always used HomeAssistant, didn’t you know? :wink: And for good reason! Because when you have your blinds, lights, coffeemaker, etc, the effort to implement them into HomeAssistant is extremely effortless. And when that’s done, there is no stopping you from automating it all to your hearts content.

This guide assumes that you already have stuff working in Homeassistant which you want to automate. If not, feel free to look at the following for inspiration:


To perform the automation on the Homeassistant side of things I’ve used Appdaemon. The advantage of Appdaemon is that it allows you to create more advanced automations using Python.

Installing Appdaemon itself is out of scope for this page, and is better explained by the author here: Installation — AppDaemon 4.2.1 documentation

In my case, the following script is used to wait for the alarm to be set for the next day, and add timers to trigger happenings based on it.

My ugly (but functional) script


If you read through the script, you’ll see that it’s very much custom tailored towards me, and you will need to make many changes to make it match your need.
Currently my version performs the following:

  • When the alarm is set, fade down the lights in the room until 10%
  • After 25s (LIGHTS_OFF_AFTER_ALARM_SET), turn the lights off
  • One hour (TIME_BEFORE_ALARM) before the alarm goes off, start turning the lights on gently
  • 20 minutes (RADIOTIME_BEFORE_ALARM) before the alarm goes off, turn on the radio at a low volume
  • 30 seconds after the alarm has gone off, start brewing coffee (COFFEETIME_AFTER_ALARM)

Take it more as a inspirational template, than a finished product. Look through it, and change the Id’s, services and timings as you need. The Appdaemon documentation will probably come in handy.


To install the script, simply copy it over to the apps directory of appdaemon. In my setup this is under ~/.appdaemon/apps. In addition to the script, you need a YAML configuration file in the same directory, something similar to this:

  module: wakemeup
  class: WakeMeUp

The directory will then look similar to this:

~/.appdaemon/apps$ ls
__pycache__  wakemeup.yaml

Tasker for Android

On the Android side of things we use Tasker and the AutoAlarm plugin to monitor set alarms and ship them over to Homeassistant.


CallHASS task

First we need to configure a task to help Tasker with calling the HomeAssistant API.
To make things easier, I’ve provided a XML dump of the task here: CallHASS.tsk.xml


Next up we need to set some variables for the task.

  • %HA_ADDR should be set to the base URL of your HomeAssistant instance.
  • %HA_AUTH should be a “Long Lived Access Token”, see Authentication - Home Assistant for more details.

Set alarm task

Then, if we want to make a button/widget to transmit the currently set alarm to HomeAssistant we can do so as this:

(again, to make things easier, I have a XML you may import to Tasker here: Set_alarm.tsk.xml )

2. Perform task

If the XML import above failed you, this is how the “2. Perform task” in the previous screenshot was configured.

Running the task

If you imported the Task from the XML (or created it correctly manually), you should now be able to run it by pressing the play-button. This should then result in you now getting a “Sleep Alarm” sensor in Home Assistant which denotes when your next alarm is set for.

Press the following button to get redirected to your entities list.
Open your Home Assistant instance and show your entities.

Sleep As Android

To automatically trigger tasker to send the alarm time to HomeAssistant I’ve coupled the task with a trigger from “Sleep As Android”. Note, this app is not necessary, you may also trigger Tasker in other means (eg. on a timer, or with other apps if they support it).

To configure this I made a Profile in Tasker where the “Set Alarm Task” is ran each time I start the sleep-tracking in “Sleep As Android”.


Congrats, now you live in the future too!

This post became somewhat messy and lacking in explanation in various parts, as due to all the different software components involved it’s hard to explain them all in the same detail. Therefore feel free to @me here for any part where you feel I should enter more words!

1 Like