Use Tasker to wake up my device at specified intervals

2,503 views
Skip to first unread message

Formula400Pontiac

unread,
Jan 13, 2018, 5:17:35 PM1/13/18
to Tasker
Hi guys.
Have just installed Tasker app on my Samsung phone with a specific goal in mind.
This goal is to have my Android device regularly waking up from doze and perform a couple of wifi related tasks.

The reason i want my phone wake up at specified intervals is that i want to use my androids device online status on my local network to trigger and keep alive a presence detection rule used in OpenHab (an open source smart home system).
Presence detection can be done with multiple triggers spanning a wide range of possible triggering devices but it usually involves mobile devices wifi or bluetooth connection status. This is what i want to make more reliable.
As you all know the option "Keep WIFI on during sleep" won't help whenever the device enters deep sleep (Doze) and this is what keeps my current present detection rule work properly. Present status is that my phone will enter doze after just few minutes of inactivity.
I'm pretty sure doze could be turned off completely on a rooted android phone but rooting the phone is out of the question for now.

I have tried multiple solutions to use Tasker to reconnect to my router (wifi) but every attempt seemed to fail when the device entered Doze (deep sleep). After realizing this i found this information:

The platform exits the device from Doze when it detects:
  • User interaction with device.
  • Device movement.
  • Device screen turns on.
  • Imminent AlarmClock alarm 
link to this information: Doze lifecycle

So this got me thinking about the possibility to set an alarm schedule that exits the device from Doze during the time i don't interact with my device.

Primary goal: Trigger a task that exits the device from doze
Secondary goal: If the solution involves setting an alarm it would be nice also to automate a solution to dismiss and remove the alarm instance without disturbing me.

Im currently investigating the send intent (task) in Tasker but have not been able to figure out the proper way to do this.

This is what i currently have worked out as a a "Set Timer action":

Task: Send intent
Action: android.intent.action.SET_TIMER
Extra: android intent.extra.alarm.LENGTH:600  (I assume this would mean 600 second before alarm but have not been able to confirm this)
Target: Action

I've tested this task with the "play" button in the task editor and this triggers the opening of the Clock app in "Timer" mode but nothing more happens.

Hope some of you have a answer to my problem because i have spent hours upon hours googling this and with no help found...

Rich D

unread,
Jan 13, 2018, 7:03:44 PM1/13/18
to Tasker Google Groups Post



This goal is to have my Android device regularly waking up from doze and perform a couple of wifi related tasks.


So this got me thinking about the possibility to set an alarm schedule


With the proper settings I'm Tasker you should be able to use a time context that repeats to wake the device. First check all of the relevant settings here.

Tasker new doze settings power managment. 



When you set a time context you can leave the from and till options  not set and just use the "every" option to fire a task every x min/hrs.


Is there a power concern or would you just like the device to never sleep? There is also a option within a tasks properties to 'keep device awake' so you could just have a continuous task running with this option checked as well. 




To post your profile or task here...  Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).



Formula400Pontiac

unread,
Jan 14, 2018, 6:12:01 AM1/14/18
to Tasker
I've already tested this with suggested settings. No luck. Doze seems to paralyze Tasker.
The phone enters Doze after just 2-3minutes and will stay in this state for a longer period unless i interact with the phone. Interaction with the phone will immediately trigger the set task (WIFI turn on).
This suggest that the Time based profile have completed the 10 minute countdown i selected for but could not perform the task linked to the profile.

My phone runs Android 7.0 Nougat btw

Duck Redbeard

unread,
Jan 14, 2018, 7:42:20 AM1/14/18
to Tasker
In battery settings do you have Tasker optimized?

Formula400Pontiac

unread,
Jan 14, 2018, 8:40:00 AM1/14/18
to Tasker
No. Its in the exclusion list and should theoretically not be affected by battery optimization

Rich D

unread,
Jan 14, 2018, 8:48:00 AM1/14/18
to Tasker Google Groups Post
'No. Its in the exclusion list and should theoretically not be affected by battery optimization


Could  you post you exported profile description?



To post your profile or task here...  Long press on the profile or task name / ( 3 dot menu with 4.0+ ) export / export "DESCRIPTION" to clipboard (not XML)

Any linked tasks will be exported with the profile they are linked to..

To be able to export, The beginner mode needs to be off and the profile needs to be named by you (Not the Tasker listed name.  Tasker will list your profile with the context name if you have not given it one).



Try enabling the run log and check to see if the profile triggers at the correct time. 

Could you post a screen shot  of the relevant runlog times as well. 


Formula400Pontiac

unread,
Jan 14, 2018, 9:15:21 AM1/14/18
to Tasker
Profile: InteruptDoze (7)
Time: Every 10m
Enter: WakefromDoze (3)
A1: WiFi [ Set:On ]
A2: Wait Until [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ] If [ %HOME ~ 1 ]

%HOME ~ 1 variable is set to 1 when my phone is logged in at my home SSID

Rich D

unread,
Jan 14, 2018, 9:34:39 AM1/14/18
to Tasker Google Groups Post
Seems strange, many have complained about Tasker not working in doze mode but after checking those settings the issue was solved.

Did you also check this one?

Samsung (Android 5.1.1+)
Some Samsung devices have a Smart Manager app. Launch the app, press the battery quarter of the screen, under App optimisation press DETAIL where you can adjust the settings for each app. It's advisable to disable this for Tasker if you are having reliablity problems

Formula400Pontiac

unread,
Jan 14, 2018, 9:57:21 AM1/14/18
to Tasker
Found this info Android Nougat - Features
The "Doze" power saving mechanism introduced in Android Marshmallow was expanded to include a state activated when the device is running on battery and the screen has been off for a period of time but is not stationary. In this state, network activity is restricted, and apps are granted "maintenance windows" in which they can access the network and perform background tasks. As in Marshmallow, the full Doze state is activated if the device is stationary with its screen off for a period of time.

This is exactly what seems to be the case when i have a look in the event log in my OpenHab system. If i leave the phone without interacting with it it goes into Doze mode and turn of wifi after just a few minutes. Then it turns wifi on every 20-30 minutes leaving it on for a varying amount of time depending on how many app updates being pushed out at the time. After this wifi is turned off as phone again enters Doze mode.

This was why i suggested using the clock alarm to wake up the phone from Doze. Maybe not the most elegant methode but it theoretically should work i could work out how to use the "send intent" task

Formula400Pontiac

unread,
Jan 14, 2018, 10:02:06 AM1/14/18
to Tasker
Im pretty sure this was answered earlier but yes Tasker is excluded from the App optimisation in my settings.

Scott Miller

unread,
Jan 14, 2018, 10:20:23 AM1/14/18
to tas...@googlegroups.com
I use an old plugin called Secure Settings to turn my screen on for 1 second every 30 minutes at night. It keeps the phone from going into deep sleep. I need to receive email and text alerts on time, and this has worked for me. 

Scott

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Formula400Pontiac

unread,
Jan 14, 2018, 10:26:10 AM1/14/18
to Tasker
Interesting! Can you please describe this solution a bit more. I have this app already installed but have not used it for any tasks yet.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.

Scott Miller

unread,
Jan 14, 2018, 10:48:48 AM1/14/18
to tas...@googlegroups.com
Profile: Prevent Deep Sleep (58)
Enforce: no Notification: no
Time: From 11:00PM every 30m Till  6:00AM
State: Power [ Source:Any ]
Enter: Prevent Deep Sleep Enter (55)
A1: Secure Settings [ Configuration:Screen Dim
1 Second Timeout (Seconds):0 ] 


Scott M.

To unsubscribe from this group and stop receiving emails from it, send an email to tasker+unsubscribe@googlegroups.com.

Formula400Pontiac

unread,
Jan 14, 2018, 10:59:04 AM1/14/18
to Tasker
Brilliant! I will investigate this and modify this to suite my needs. Will be back with a status report later after testing

Formula400Pontiac

unread,
Jan 14, 2018, 12:32:38 PM1/14/18
to Tasker
Nope. Didn't work. This is my profile/task:
Profile: WakefromDoze (8)
Enforce: no Notification: no
Time: Every 12m
State: Power [ Source:Any ]
Enter: TurnOnScreen (9)

Rich D

unread,
Jan 14, 2018, 1:02:43 PM1/14/18
to Tasker Google Groups Post
Have you checked the Run log for any of these to see if/when the profiles are going active? 

Formula400Pontiac

unread,
Jan 14, 2018, 4:54:38 PM1/14/18
to Tasker
Here is parts from the log:
20180114 22.12.00 T ExitOK ID9 TurnOnScreen
20180114 22.12.00 E Stop ID0:0.0 TaskService
20180114 22.24.00 P Instant ID8 WakefromDoze
20180114 22.24.00 E Start ID0:0.0 TaskService
20180114 22.24.00 T Running ID9 TurnOnScreen
20180114 22.24.00 A OK ID9.1 TurnOnScreen.com.intangibleobject.securesettings.plugin\n***\n*!&$*;com.intangibleobject.securesettings.plugin.Activities.TabsActivity
20180114 22.24.00 T ExitOK ID9 TurnOnScreen
20180114 22.24.00 E Stop ID0:0.0 TaskService
20180114 22.36.00 P Instant ID8 WakefromDoze
20180114 22.36.00 E Start ID0:0.0 TaskService
20180114 22.36.00 T Running ID9 TurnOnScreen
20180114 22.36.00 A OK ID9.1 TurnOnScreen.com.intangibleobject.securesettings.plugin\n***\n*!&$*;com.intangibleobject.securesettings.plugin.Activities.TabsActivity
20180114 22.36.00 T ExitOK ID9 TurnOnScreen
20180114 22.36.00 E Stop ID0:0.0 TaskService
20180114 22.38.51 E Start ID0:0.0 TaskService
20180114 22.40.39 E Stop ID0:0.0 TaskService
20180114 22.48.00 P Instant ID8 WakefromDoze
20180114 22.48.00 E Start ID0:0.0 TaskService
20180114 22.48.00 T Running ID9 TurnOnScreen

Seems like Tasker is performing ok?

Formula400Pontiac

unread,
Jan 14, 2018, 5:23:59 PM1/14/18
to Tasker
Update: I didn't take into account that i had my phone connected to the charger.
This will keep WIFI on and prevent phone entering Doze Mode.
I bet the log from a non charging device would tell a different story. But that will have to wait for another day. Now i need to charge my phone to be ready for bedtime (i dont like charging my devices during the night)
Reply all
Reply to author
Forward
0 new messages