[v1.3] Tasker: Screen off=wifi/data off(no traffic+)AutoSync+Night/Reduce CellStandby

Search This thread

parthipanramesh

Senior Member
Sep 29, 2012
260
279
27
Idar-Oberstein
Cell Standby Battery Drain:

Hey Guys!!
Maybe some of you know it. The cell standby drains a lot of battery. I live in a mounterial arrea and it's really annoying. So I searched a bit on Google and build a small Tasker "Script" to reduce the draining. I'm using it now for 6 weeks and it's working good! It reduced my cell standby from 35% to 2%.

So what's the magic?
First tasker will turn Airplane Mode (only cell!) on if you don't have signal. Then it'll wait for 5 minutes and check it again. Yes this sounds really simple but it was hard to build it. ;)
I hope I can help you with sharing my experiences! :)

Screen off=data/wifi off it no traffic (with Night Mode):

Hey Guys, I have been looking for a solution for this problem for quite a while myself. Now I found a good solution to collect the current traffic on all interfaces. I will share a detailed explanation on how to set it up.
First off, what will happen?

If you want tasker to turn Wifi or Mobile Data off when you the turn Screen off normally you have the problem that it will interrupt all downloads. This Profile will try to read the traffic. If the traffic is below 15 kb it will turn wifi or mobile data off. If not it’ll wait until it is below 15kb. Later If you turn your screen on again tasker will activate mobile data and wifi. It'll wifi doesn't connect to a network (in the next 30 seconds) it will turn wifi off.

How does Tasker work? How can I optimize these profiles/tasks for my needs?
First what does tasker do? This is for the people who don't understand tasker. Tasker has 4 tabs (Profiles, Tasks, Scenes and Vars) but I won't talk about Scenes cz I didn't uses it yet. I also won't talk about Vars (variables) cz they are self explaining.

What are Profiles?
Basically profiles contain conditions (for example if display on/off or wifi on/off) and run a task if the condition is true. Example: If display off turn wifi off.
What are Tasks?
A task is something like a list of actions which the phone should do. (for example turn data on/off or run a specific app)

How do the profiles from this thread?
The profile AutoSync (Screen off) runs every 10 minutes while the screen is off. It turns data/wifi on checks for new messages and turns it off. It has a variable called "%SLEEP". It will only run if "%SLEEP" doesn't match "1".
The profiles Display (Data) and Display (Wifi) turns data/wifi on when the user turns the screen on. When the screen is off again it will check traffic for 30 seconds. If the traffic is below 15kb/s it will turn data/wifi off. If not it will wait 2 minutes and check the traffic again for 30 seconds until the traffic is below 15kb/s.
The profile Night (week), Night (weekend) turn the phone into airplane mode and sets the variable "%SLEEP" to "1".
The profile Wifi connected just changes the variable "%CONNECTION to "1" or removes the "1". This is needed for the Display (Wifi) profile.

On my todolist:
  • You say..
Changelog v1.3:
  • Added Greenify's hibernate now to both screen off tasks
Changelog v1.2:
  • Added AutoSync (every 10 minutes if screen is off)

I'm using this profiles on my Samsung Galaxy Nexus and it works very well!!
Feel free to ask me if you have problems! I'll try my best to help you. :)

These profiles include the greenify hibernate action from its plugin. If you have troubles with it you have to remove and readd it (on both Screen off tasks) cz my plugin is german. (plugin → hibernate)

You need Secure Settings for tasker or it won't work!! I used Secure Settings because Secure Settings can off only the cell radio. Tasker supports it, too. But not for Jelly Bean and I'm using 4.2.2 :/

How to import *.prj.xml files:

Unzip the *.prj.xml file in your Tasker/projects directory and then import it in Tasker by long-clicking the home icon or any of the other tabs. If you don't have the home tab, swipe down from the top in Tasker to show the tabs. (beginner mode must be disabled!)
 

Attachments

  • Traffic_Screen_off_with_Nightmode_v1.0.zip
    13.8 KB · Views: 4,242
  • Cell_Standby_v1.0.zip
    6.1 KB · Views: 4,789
  • Traffic_Screen_off_with_Nightmode_v1.1.zip
    13.3 KB · Views: 2,780
  • Traffic_Screen_off_with_AutoSync_and_Nightmode_v1.2.zip
    15 KB · Views: 3,871
Last edited:

The-Droidster

Senior Member
May 27, 2012
1,295
892
XDA 24 x 7
In task screen off, why do you wait for 30 sec's in Action number 5? Also how important is the Stop Task Action? What happens if I don't include it? I mean anyways, the following 'else' won't be executed if the Mobile data turned off by the 'if'.
 
Last edited:

kala123

Senior Member
Nov 17, 2009
127
18
Just what I looked for, but How can I install your *.zip file to tasker? I just cant install it, any hint? where should I put the zip file?
 

parthipanramesh

Senior Member
Sep 29, 2012
260
279
27
Idar-Oberstein
In task screen off, why do you wait for 30 sec's in Action number 5? Also how important is the Stop Task Action? What happens if I don't include it? I mean anyways, the following 'else' won't be executed if the Mobile data turned off by the 'if'.

You have to wait 30 seconds or how long you want to wait cz in action number 2 tasker gets a traffic number from the system. After 30 seconds it gets another. Tasker subtracts the values to get the actual traffic in bytes. So Tasker can look if the traffic is below 15 kb/s. Yes you're right. It's my fault. You don't need the Stop Task Action. It's from the old Script. I forgot to remove it. Thanks for your hint! ;)
 

RLicher

Member
Jan 19, 2013
7
1
Hi parthipanramesh,

what I metioned inside the other Thread seems to be working A okay...
What are the modifications/fixes in this version? I can't tell from looking at it here. ;)
 

parthipanramesh

Senior Member
Sep 29, 2012
260
279
27
Idar-Oberstein
Hi parthipanramesh,

what I metioned inside the other Thread seems to be working A okay...
What are the modifications/fixes in this version? I can't tell from looking at it here. ;)

Hi RLicher,
Some people had the issue with the maths calculation of CHECKB_WIFI - CHECKA_WIFI. So tasker will set the variables to 0 if they aren't set. (cz wifi is off or something else). And I deleted/merged some Actions.

You can use the version from the other thread if you don't have problems ;)
 
  • Like
Reactions: ragemode

nappent

Senior Member
I'm using this on SGS3 but notice two issue... While listening to Pandora when a song ends the data or wifi will get disabled so the next song cant start. Second wifi or data will not be reenable when the screen is enabled.

For the record i just imported the files within the zip.
 

parthipanramesh

Senior Member
Sep 29, 2012
260
279
27
Idar-Oberstein
I'm using this on SGS3 but notice two issue... While listening to Pandora when a song ends the data or wifi will get disabled so the next song cant start. Second wifi or data will not be reenable when the screen is enabled.

For the record i just imported the files within the zip.
First you have to increase the 30 seconds from the two Screen off tasks [A5] because Tasker checks the traffic for 30 seconds. If Pandora loads a song for example in 40 seconds Tasker will disable data and wifi after it has been loaded. So data and wifi are turned off when Pandora tries to play the next song. Increase the value and you should be good. ;)

And for your next issue:
Delete the imported profile and create a new profile:
Name: Whatever ;)
Context: State → Display On
Task: Create a task which enables data and wifi
Exit Task: Screen off
 
Last edited:

parthipanramesh

Senior Member
Sep 29, 2012
260
279
27
Idar-Oberstein
How do we import?

Sent from my SGH-T999 using xda premium
Sorry I didn't read your previous post.
Unzip the *.tsk.xml files to sdcard/Tasker/tasks and the *.prf.xml to sdcard/Tasker/profiles. Then open tasker tap on tasks and hold it until a menu appears. Tap on import and you should see the files. Do this for the profile aswell.
First tasks and then profiles!! Or you'll get an error that tasker couldn't find the the task for the profile.
 
  • Like
Reactions: diggmc

Iceax123

Senior Member
Oct 26, 2012
632
121
Cheshire, Uk
Thanks just pinched your files and made it turn on when the screen comes on.

My current profiles means that Wifi turns off when i leave the office and stays off until I turn it on again.

If im somewhere with no wifi will my wifi be turned on when my screen is turned on?

Would i need to create another profile which says if wifi is on and not connected to a network after X minutes
then please disable?

If so is that an easy one to create?

Thanks

Andy
 

parthipanramesh

Senior Member
Sep 29, 2012
260
279
27
Idar-Oberstein
Thanks just pinched your files and made it turn on when the screen comes on.

My current profiles means that Wifi turns off when i leave the office and stays off until I turn it on again.

If im somewhere with no wifi will my wifi be turned on when my screen is turned on?

Would i need to create another profile which says if wifi is on and not connected to a network after X minutes
then please disable?

If so is that an easy one to create?

Thanks

Andy

First yes it will enable wifi.
I solved it with 2 profiles. One changes a variable if wifi is connected or not and the other one is turns wifi on, waits 30 seconds, checks the variable. If my phone is not connected to a wifi it will turn it off.

Do you want my profiles?
 
  • Like
Reactions: Iceax123

Iceax123

Senior Member
Oct 26, 2012
632
121
Cheshire, Uk
Re: Tasker solution: Screen off=wifi/data off if no traffic

Yes please that would be excellent

Thanks

Andy

Sent from my HTC One X using xda app-developers app
 

Iceax123

Senior Member
Oct 26, 2012
632
121
Cheshire, Uk
Re: Tasker solution: Screen off=wifi/data off if no traffic

Just one last question if I may.

Using this if I turn of data as well will that stop any emails coming in.

I have 3g turned off so am always on 2g but would still want push mail from one account to get through

Thanks

Sent from my HTC One X using xda app-developers app
 

Iceax123

Senior Member
Oct 26, 2012
632
121
Cheshire, Uk
Also found another issue now :(

I have a rule set up so when connected to works wi-fi my ringer and notifications are set to low.

But now when i turn my screen off wifi drops and my volume goes up. ARGHHHHH

Andy
 

parthipanramesh

Senior Member
Sep 29, 2012
260
279
27
Idar-Oberstein
Yes please that would be excellent

Thanks

Andy

Sent from my HTC One X using xda app-developers app

Look in the OP!! New version ;)

Just one last question if I may.

Using this if I turn of data as well will that stop any emails coming in.

I have 3g turned off so am always on 2g but would still want push mail from one account to get through

Thanks

Sent from my HTC One X using xda app-developers app

Yes it will turn generally data off. 2g or 3g it doesn't matter.

Also found another issue now :(

I have a rule set up so when connected to works wi-fi my ringer and notifications are set to low.

But now when i turn my screen off wifi drops and my volume goes up. ARGHHHHH

Andy

It have nothing to do with my profiles and tasks. They only enable connections, check traffic and disable the conncections. Maybe another profile isn't working correctly.

And next time you can edit your post. You don't need to make 3 posts. ;)
 
  • Like
Reactions: Iceax123

bluesfear

Member
Feb 4, 2013
42
3
Toronto
I am new to tasker and i have been fiddling with it.

How would I add auto sync turns on every 15 minutes when screen is off and auto sync turns on when screen is on to this "script"?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 110
    Cell Standby Battery Drain:

    Hey Guys!!
    Maybe some of you know it. The cell standby drains a lot of battery. I live in a mounterial arrea and it's really annoying. So I searched a bit on Google and build a small Tasker "Script" to reduce the draining. I'm using it now for 6 weeks and it's working good! It reduced my cell standby from 35% to 2%.

    So what's the magic?
    First tasker will turn Airplane Mode (only cell!) on if you don't have signal. Then it'll wait for 5 minutes and check it again. Yes this sounds really simple but it was hard to build it. ;)
    I hope I can help you with sharing my experiences! :)

    Screen off=data/wifi off it no traffic (with Night Mode):

    Hey Guys, I have been looking for a solution for this problem for quite a while myself. Now I found a good solution to collect the current traffic on all interfaces. I will share a detailed explanation on how to set it up.
    First off, what will happen?

    If you want tasker to turn Wifi or Mobile Data off when you the turn Screen off normally you have the problem that it will interrupt all downloads. This Profile will try to read the traffic. If the traffic is below 15 kb it will turn wifi or mobile data off. If not it’ll wait until it is below 15kb. Later If you turn your screen on again tasker will activate mobile data and wifi. It'll wifi doesn't connect to a network (in the next 30 seconds) it will turn wifi off.

    How does Tasker work? How can I optimize these profiles/tasks for my needs?
    First what does tasker do? This is for the people who don't understand tasker. Tasker has 4 tabs (Profiles, Tasks, Scenes and Vars) but I won't talk about Scenes cz I didn't uses it yet. I also won't talk about Vars (variables) cz they are self explaining.

    What are Profiles?
    Basically profiles contain conditions (for example if display on/off or wifi on/off) and run a task if the condition is true. Example: If display off turn wifi off.
    What are Tasks?
    A task is something like a list of actions which the phone should do. (for example turn data on/off or run a specific app)

    How do the profiles from this thread?
    The profile AutoSync (Screen off) runs every 10 minutes while the screen is off. It turns data/wifi on checks for new messages and turns it off. It has a variable called "%SLEEP". It will only run if "%SLEEP" doesn't match "1".
    The profiles Display (Data) and Display (Wifi) turns data/wifi on when the user turns the screen on. When the screen is off again it will check traffic for 30 seconds. If the traffic is below 15kb/s it will turn data/wifi off. If not it will wait 2 minutes and check the traffic again for 30 seconds until the traffic is below 15kb/s.
    The profile Night (week), Night (weekend) turn the phone into airplane mode and sets the variable "%SLEEP" to "1".
    The profile Wifi connected just changes the variable "%CONNECTION to "1" or removes the "1". This is needed for the Display (Wifi) profile.

    On my todolist:
    • You say..
    Changelog v1.3:
    • Added Greenify's hibernate now to both screen off tasks
    Changelog v1.2:
    • Added AutoSync (every 10 minutes if screen is off)

    I'm using this profiles on my Samsung Galaxy Nexus and it works very well!!
    Feel free to ask me if you have problems! I'll try my best to help you. :)

    These profiles include the greenify hibernate action from its plugin. If you have troubles with it you have to remove and readd it (on both Screen off tasks) cz my plugin is german. (plugin → hibernate)

    You need Secure Settings for tasker or it won't work!! I used Secure Settings because Secure Settings can off only the cell radio. Tasker supports it, too. But not for Jelly Bean and I'm using 4.2.2 :/

    How to import *.prj.xml files:

    Unzip the *.prj.xml file in your Tasker/projects directory and then import it in Tasker by long-clicking the home icon or any of the other tabs. If you don't have the home tab, swipe down from the top in Tasker to show the tabs. (beginner mode must be disabled!)
    5
    Care to share your mods?
    Perhaps your whole project file?

    This mod is working very well, but any improvements can only make a good thing better:)
    Regards

    Here is the project file. It is heavily modified from the original ( I changed a lot of the variable names to be more descriptive for me ) I did add a bunch of comments as well as a logging system and wifi zone system. ( I used a text editor on the project xml to do bulk string replaces for the variables).

    Notes:
    • The logging system does not lend itself to proper battery management so I would leave it turned off unless debugging.
    • The wifi off with screen modification is still a work in progress, I have it turned off since the wifiZone function i am still debugging ( it still gives awesome battery with it turned off...)
    • The 'screen off' cutoff rate is in actual bytes per second (unlike the original script which had a cutoff of was in 15 kilobytes per 30 seconds or 0.5 Kbps ).
    • current data rate is calculated using the time span defined in the Battery Init Variables
    • Sleep mode is now LowPowerMode where the phone shuts down everything but 2G calls and texting (I don't care what time it is I still need to receive calls/texts, emails however I don't think so ).
    • the wifi zone system will need local configuration as I deleted all of 'my' cell towers (don't forget to get both the 3G and 2G towers, this will require switching between 2G and 3G modes manually to get all the possible towers).
    2
    Hi guys,
    I have a custom version that I would like to share with you if you are interested! I don't use 3g and have a pocket wifi so I disabled and erased everything about mobile data.

    I also added two buttons on my home screen (icons are from kyo-tux aeon collection) to keep the wifi on always and one to launch the Sleep procedure in case I go to sleep earlier than the set time (but will revert if the screen is turned back on and the set sleep time condition is not true) .

    The wifi will always turn on, at anytime of the day and night if I turn the screen on.

    I also added a charging condition so when it is plugged to a charger the wifi always stays on.

    There are many changes and I would love to know if y'all could check it and let me know if I can make it better.

    There us also a function to turn off the always on wifi task if the screen is off for like 2 hours in case you just forgot to switch back the always on mode to normal.

    Peace

    Download here :

    https://www.box.com/s/lc47l637hcci6fdg5e7e
    2
    What can I do to remove all the moble data checks on this? I don't have a cell radio...

    Sent from my ASUS Transformer Pad TF700T

    hello,
    I was having the same issue, see the solution in my post : http://xdaforums.com/showpost.php?p=40100351&postcount=101 :fingers-crossed:
    2
    Hey thanks for that, im actually already using v1.2 thats all i really need and I also turn off the night mode as my phone is on the charger the whole night anyway.

    But still getting this problem, wifi and mobile data just wont turn off when the screen is tuned off.

    You would have to go into your WiFi -> advanced... And turn off the always scanning feature...

    Sent from my Vivid 4G using Tapatalk 4