Tasker battery drain when using "wait until %WIFII ~ *connected*"

981 views
Skip to first unread message

jon

unread,
Jan 20, 2011, 10:58:21 AM1/20/11
to Tasker
On my HTC Desire Z, I have tasks based on location:
* Turn on WIFI
* Wait Until "%WIFII equals *connected*"
* Turn on Autosync
This task cause tasker to spend an awful lot of battery all day long
(I also notice my phone becoming nice and warm). Changing the Wait
task to a "Wait, 2 minutes" does not display the same behavior, only
the "Wait until", as I have experimented with both and narrowed it
down to this. With the "Wait until" option Tasker spends most of my
battery (over 50%) and drains my battery in under 10 hours of usage..

This must be a bug? Or am I not using the "Wait until" task correctly?
It does work as I want it to, but the battery draining is
unacceptable. Using the "Wait, 2 minutes" task instead is just a
workaround, as I do not want autosync to be turned on if I am not
connected to a Wifi network and this may happen without the "Wait
until" task.

OBones

unread,
Jan 21, 2011, 5:31:34 AM1/21/11
to Tasker
This surely is not a bug, it's a very common mistake made by many
developers in many languages.

What you have here is a loop that gives absolutely no time back to the
system. This means that the CPU is at 100% until you exit the loop
which can take a long time, or could even never finish at all.
Wait 2 minutes is completely different because it is implemented in
such a way that it uses no CPU at all.

What you could do in your case is to have Wait 1 second, then a goto
with "if" to redo the wait.
This way you have a similar loop but you only check every second,
leaving the CPU usage low for most of the time.

And to go further, you don't even need to wait at all as AutoSync will
only work when the network connectivity is up.

Rudolf

unread,
Jan 21, 2011, 9:52:24 AM1/21/11
to Tasker
What interval did you specify with your Wait Until?

This interval defines how fast your loop runs.
I.e. check every 2 minutes if %WIFII matches *connected* (I'd use
'matches' instead of 'equals')

Without a proper interval you have a battery drainer.

jon

unread,
Jan 21, 2011, 6:59:40 AM1/21/11
to Tasker
Aha, now I understand, thanks.

The wait - goto task is a much better solution :)

However you are wrong on your last point, as my phone DOES support
AutoSync without Wifi, using Mobile Data (thus my need for this task,
as I do not want autsync enabled when not on wifi, to minimize mobile
data traffic cost with my provider).

But thanks for your helpful answer

OBones

unread,
Jan 21, 2011, 4:11:44 PM1/21/11
to Tasker
I assumed you also turned off mobile data like I do.
As it turns out you are not, then yes, autosync should be triggered
via the task
But maybe you could do without the wait and use a "variable set"
context in a new profile to have it turned on whenever the %WIFII
value has changed to connected

Rudolf

unread,
Jan 23, 2011, 6:46:21 AM1/23/11
to Tasker
How about the State - 'Wifi Connected'?
Reply all
Reply to author
Forward
0 new messages