How do you sleep at night?

Unwritten rule of the household of mine is to keep your devices quiet once you get to bed. This would be a very simple profile, however:

  • I work nights
  • I don’t work your regular Monday to Friday
  • I’m not home during my workdays
  • Occasionally I stay up till late and home to work on stuff like this article and the tutorial

Tasker – Smart sleep profile allows above conditions to be included. I’m not sure how messed up is your sleep pattern and how much you need something like this. Sleep profile requires no plug-ins, or root, and shows you how to set this up for any circumstances. The profile can be improved with AutoNotification plug-in, however for the sake of the beginners I will keep it vanilla for now!

How does the sleep profile work?

I have main profile to trigger silent times (or just disable WIFI and network up to your preferences). The profile is triggered by additional 2 profiles that are monitoring my location (HOME/NOTHOME) and whether I’m at work. Each day at 22:00 Tasker checks what’s going on and triggers the sleep profile in my project. At this stage, I get an hour warning message which allows me to cancel the sleep profile all together, or postpone it.  While I’m away, Tasker skips the sleep profile when I’m at work, or gives me a notification only to enable  the sleep now, cancel it for that night or,  set it in an hour.  If no action is taken the profile will won’t take any actions.

tASKER SMART SLEEP PROFILE

More detailed, written instructions are also available on pocketables.com so have a look if you want to read more, rather than watch the video.

 

Sleep profile set up

[toggle title=”You can see the profile description here”]

[tabs]
[tab title=”SLEEP TIME”]

Profile: Sleep Time (16)

Restore: no

Time: From %SleepTime Till 07:06

Enter: Sleep+ (14)

A1: Flash [ Text:Sleeping Long:On ]

A2: Notify Cancel [ Title:Sleep Profile Warn Not Exist:Off ]

A3: Notify [ Title:In Sleep Text:Your sleep mode is ON Icon:hd_ab_aaa_ext_io Number:0 Permanent:Off Priority:3 Actions:(1) ]

 

Exit: Sleep- (15)

A1: Flash [ Text:Wake up Long:On ]

A2: Perform Task [ Name:Cancel Priority:%priority Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable: Stop:Off ]

[/tab]
[tab title=”WARNING AT HOME”]

Profile: Warning At Home (17)

Restore: no

State: Variable Value [ %Home ~ 1 ]

Time: From 22:00

Enter: Enable Sleep (18)

A1: Variable Set [ Name:%SleepTime To:23.00 Do Maths:Off Append:Off ]

A2: Profile Status [ Name:Sleep Time Set:On ]

A3: Notify [ Title:Sleep Profile Text:Profile will enable at %SleepTime Icon:hd_ab_device_access_time Number:0 Permanent:Off Priority:3 Actions:(2) ]

 [/tab]
[tab title=”WARNING OUTSIDE”]

Profile: Warning Outside (21)

Restore: no

State: Variable Value [ %Home ~ 0 ]

Time: From 22:00

State: Variable Value [ %Work ~ 0 ]

Enter: Enable Warning (22)

A1: Notify [ Title:Sleep Profile Text:Would you like to enable sleep? Icon:hd_aaa_ext_bulb Number:0 Permanent:Off Priority:3 Actions:(3) RUN TASK Cancel, Sleep Now, Postpone ]

 [/tab]
[tab title=”OTHER TASKS”]

Cancel (20)

A1: Notify Cancel [ Title:Sleep Profile Warn Not Exist:Off ]

A2: Notify Cancel [ Title:In Sleep Warn Not Exist:Off ]

A3: Notify Cancel [ Title:Pending Sleep Warn Not Exist:Off ]

A4: Variable Clear [ Name:*Time* Pattern Matching:On ]

A5: Profile Status [ Name:Sleep Time Set:Off ]

 

 

Postpone (19)

A1: Notify Cancel [ Title:Sleep Profile Warn Not Exist:Off ]

A2: Variable Set [ Name:%SleepTime To:%TIMES +3600 Do Maths:On Append:Off ]

A3: Variable Convert [ Name:%SleepTime Function:Seconds to Date Time Store Result In:%PostponeTime ]

A4: Notify [ Title:Pending Sleep Text:The sleep will be enabled at %PostponeTime Icon:hd_aaa_ext_bulb Number:0 Permanent:Off Priority:3 Actions:(2) ]

Sleep Now (23)

A1: Variable Set [ Name:%SleepTime To:%TIMES +30 Do Maths:On Append:Off ]

A2: Profile Status [ Name:Sleep Time Set:On ]

A3: Notify Cancel [ Title:Sleep Profile Warn Not Exist:Off ]

A4: Notify Cancel [ Title:Pending Sleep Warn Not Exist:Off ]

 [/tab]
[/tabs]

[box type=”info”]

The task project file is available as a smart-sleep.prj.xml

[/box][/toggle]