How (and why) I automated my phone’s WIFI

For a few months now, I’ve been using a WIFI enabled phone. It is quite useful to cut on your 3G traffic and use the cheaper (quicker?) WIFI. When I reach home, I start WIFI on the phone and 3G is stopped. And you can enjoy plumbing courses on youtube till 2am for free. However, when you live your home, your need (to remember) to cut WIFI. I don’t know for you, but myself tend to forget this step quite often. Though your home WIFI is not near, the phone keeps searching for available networks and it drains the battery.

Investigating this question, I found Tasker, an app that allows you to automate almost everything on your Android phone. After playing with it to create a good night greeting when I turn my phone upside  / down at night, I embarqued on a WIFI Automator project. And yeah, it rocks. For 2 months now, I don’t have to remember to start / stop my WIFI when I reach / leave home: I’ve configuerd my Tasker to do that for me. Isn’t it cool?

The Use Case:

Before telling you how I configured my tasker, first let’s have a look at what I want my phone’s WIFI to work:

  1. When I get home, I want the phone to switch from 3G to WIFI.
  2. When I leave home, I want the phone to switch back to 3G
  3. When I am at the square in fron of my home, I want the phone to be on WIFI
  4. When I go to the corner store or the drugstore 1 block from my house, I want the phone to stay on WIFI because I’ll be back in less than 10 mins and there is no use to cut the WIFI.
  5. When I have to see my banker or attend a parents meeting at kids school (1 block from home), I want the phone to switch to 3G / Edge because I won’t be home before an hour at least.
  6. I want to minimize my battery usage

I will never forget to stop my WIFI:

These are the 6 requirements I have to my WIFI Automator. Let’s now see how to implement all that in tasker. One key part of the WIFI Automator is the way to stop WIFI. I created a profile WIFI Stopper and the associated task WIFI Stop. How does it work? According to my requirements, I decide to stop WIFI as long as my WIFI network is not within reach, that means when my phone cannot detect the said network.

The profile WIFI Stopper is composed of 2 contexts: a- Phone WIFI is activated (WIFI ON) and b- WIFI is not connected. If these two conditions are met, it can only mean two things: either my phone is in WIFI Sleep mode or my home network is not accessible. When the profile WIFI Stopper is activated, tasker starts the task WIFI Stop that runs until WIFI is stopped or the profile is deactivated. To avoid strange results when I go to my garage, come back to home and then leave, the task WIFI Stop is set to not allow multiple instances and run within a 5 mins loop while the profile is active.

To do decide whether to stop wifi or not, I query tasker’s built-in variable « WIFII » that  lists all the wifi networks last seen by android. If my home network is not in the list, then my network is out of reach and I have to stop WIFI. Otherwise, I leave WIFI on to respect the wifisleep policy. [Btw, it seems it is more efficient to have wifisleep set to never according to reports on the web]. To avoid intempestive stopping, I have a 45s temporisation before trying to stop the wifi.

My WIFI will start by the virtue of Tasker:

WIFI start is triggered by the profile WIFI Starter. I want my WIFI to start when I am at home. This profile is constituted of two conditions: a- WIFI is Off and b- Cell towers covering my home are near (Cell near context).  Tasker allows us different ways of monitoring location. Of all of them, I choose the cell tower way because it is the cheapest battery wise. A cell tower covers a large area, usually larger than a house. To make the best use of this location information, I organised the task WIFI Start in a stagged loop:

  1. For 15 mins, we check every 2 mins if the home WIFI is within reach
  2. After the first 15 mins, if we can’t connect and we are still under the cell tower coverage, we are probably out of home for a long time. We make a pause for 45 mins.
  3. After the 45 mins pause, we start the search cycle again.
  4. Of course, the length of each stage can be modified and you can even set up supplementary stages. For example, a stage 3 with a 2 hours pause can easily be set up.

For convenience reason, the WIFI Start task is implemented in tasker with two task: WIFI AP Search and WIFI Start. I will try to write more about it in a future post.

A few tasks to (re)initialize the system

To help this gigantic machine working well, I have two additional task. The Task WIFI Checks Params sets up all the parameters of the Automator like the names of the WIFI networks you would like to connect to, the duration of each level and each pause. The task WIFI Checks Init resets our internal timer.

How to set it up on your android

So you read until here; you deserve congratulations. To set up the WIFI Automator on your phone, execute the procedure described on Tasker Wiki.

Final Words:

Can someone help in converting the tasks and profiles in a plug-in?

Edit: if you want to handle multiple locations, have a look at this discussion.

Donate if you like my work.

Tags: , , , , , , , ,

242 Responses to “How (and why) I automated my phone’s WIFI”

  1. Caspar Armster dit :

    Hello !

    Thank you for the nice guide to setup the automatisation of WiFi. I got a small question how to setup 2 wlan spots ? I got one at home and one at work, with different cell towers and different wlan id names – how to expand your scripts to reflect this situation, or add even more spots (friends/family/etc.) with different wlans each ?

    Thank you for your help !

    • Juste MBAMBA dit :

      Hey Caspar. Actually, you deserve congratulations for reading and setting up all the stuff!
      Regarding your question, we can consider it at two levels:
      – for the WIFI Stopper, it is very simple, you have to edit the « WIFI Checks Params » in the following way. Edit action number 2. Replace *my_network*with *my_home_network*/*my_work_network*. Essentially, we are using here the power of pattern matching offered by tasker and android.

      – for the WIFI Starter, it is more subtle. The context is based on the cell tower id scanned by tasker. One thing you can do is do the scans at home. When it is working at home, copy somewhere everything scanned by tasker in the context « Cell Near ». Then, go to your workplace and start another scan. Tasker will replace the previous values. When the scna is done, edit the context and add manually the values you copied before at the end of the current values. By doing this, you will have different cells available in the context.

      Of course, depending on your comute time, it might be wise to adjust the durations adequately.

      Let me know how it plays out!

  2. Harry dit :

    Do you replace the MBJC and get rid off the ** or not? Also, could you go into a bit more detail about which bits change how long you want it to be off etc. Thanks!

    • Juste MBAMBA dit :

      Harry,
      – for the WIFI Network name (SSID), you have to keep the 2 *. You just replace MBJC. The * are needed for profile matching.
      – about the durations and levels variables: I’ll try to add a detailed description section in the article. Probably thy weekend. To make it simple, the WIFI Start is organised in laps; laps durations are controlled by variables %MLapWL. Within a lap, there are regular pauses between cheks; these pauses durations are controlled by variables %MDurWL. Lap 1 last 15 mins and the checks are executed every 2 mins. Lap 2 last 45 minutes and checks are conducted every 45 minutes (only check). For usability reasons, Laps in tasker are cumulative: %MLapWL2 is to %MLapWL1+45 mins.

  3. Justin dit :

    This is both useful and it truly saves battery life. Excellent profile! The only thing I come across from time to time is when it’s turning the WiFi back on after I get home, it throws up a Tasker Force Close message. Not sure if that’s something with a setting on my phone or something with this profile. Nevertheless; awesome work!

    • Juste MBAMBA dit :

      @Justin, thanks for testing the profile. You deserve congrats for a successful setup. ;-) for the force close, it might have to do with tasker preferences. Do you have the « run in foreground » option checked?

  4. Justin dit :

    @Juste MBAMBA, yes the option is checked.

    • Juste MBAMBA dit :

      Justin, can you have a look at Jimmy’s comment on the force close issue? It might be helpful.
      Otherwise, let’s digg a bit. What is you phone and android version? What is you tasker version? Do you have other profiles in tasker? do some of them intervene on the WIFI?

  5. Erin dit :

    Hi,

    I’d really like this profile. However I can’t seem to download the tasks or profile. All it congress up with is text like this:
    IFI AP Search 4 1 547 %TIMES -%MYSTART %MYLAPSE %TIMES 10 %MYSTART 547 %MYSTART 1 0 4 %MDurWL %MLapWL2 547 %MYLAPSE 5 130 1 WIFI Start 1 %MDurWL2 4 %MDurWL %MLapWL1 547 %MY

    Any help would be appreciated. Cheers

    • Juste MBAMBA dit :

      Erin, I think your issue comes from the fact your browser (I Guess Internet Explorer) directly opens the files. You can try this: on the download page, instead of a left click, do a right click and select save the file. This should do the work for all the downloads.

  6. Jimmy dit :

    Thank you for doing all the work so that the rest of us may enjoy. I got the cell towers and network names all setup for both my home and work wifi. I even adjusted the time to search every 30 mins instead.

    I did run into the force close issue a couple times initially. But I believe it was more of my impatience, as I was flipping wifi and ‘run in foreground’ on and off when I didn’t get an immediate connection. I left ‘run in foreground’ checked and no issues since. Thanks again!

  7. Jimmy dit :

    Hello Juste,

    I woke up this morning to find my WIFI was turned off. I did another cell tower scan and found another tower. Might have to run cell tower scanner a few different times if your WIFI goes out, b/c sometimes it doesn’t find all the towers initially…even if you run it for several minutes.

    Another note, I have run into the force close issue a couple more times. Here’s what I was doing: Once I was doing a scan cell tower in Tasker. Another time I was just reading over one of the tasks like WIFI Start or something and got the force close.

    I’m using: Droid X 2.2, Tasker 1.0.13

    I am only running one other profile, specifically this one: http://tasker.wikidot.com/sleepmode

  8. Jimmy dit :

    Hello Juste,

    I watched the Tasker program in the task manager drop down. I found that the force close consistently happens everytime it goes from WIFI Starter to WIFI Stopper. The WIFI does turn on, but of course it force closes Tasker.

    So it looks like there is some issue when it transitions from WIFI Starter to WIFI Stopper? Maybe it’s specific to 2.2 with Tasker 1.0.13? Also, my phone is not rooted.

    Droid X, 2.2, Tasker 1.0.13

  9. Justin Blankenship dit :

    @Juste MBAMBA, I haven’t toggled WiFi on at all; left it untouched to try and see if this Profile would fix itself. My Tasker Version 1.0.13, Android Version 2.2.1 on OG Droid. I removed all other profiles on tasker but this one. Looks like it at least works intermittently. Still get the Force Close issue on occasion.

  10. Justin Blankenship dit :

    @Juste MBAMBA Another bit of info that may be helpful in solving the FC issue is that when I go to scan for cell towers as described in the Wiki, under Parameters, it will not scan for any more than, say, five minutes without Force Closing the Tasker program. Just FYI.

    • Juste MBAMBA dit :

      Justin and Jimmy, it seems the Force Close is specific to the couple 2.2 / 1.0.13. I am running 2.1 / 1.0.9 on x10 myself. I request your help to test each of the 2 profiles separetely. Let’s start by disabling the starter profile (click on the profile and disable). Test the wifi stopper by activatong manually the wifi on the phone, and unplugging the power supply of the wifi router. See if tasker stops the wifi. Test it a few times and let us know if there is any force close.
      Ps: in android parameters, do you have your wifi sleep policy set to never? If not, try and test.

  11. Danny dit :

    I really like this set of profiles, wonderful job on creating this. There is just one thing I want to add to it but I havent figured out how to do it. I want it to disable wifi and data all together during a specified time. Like from midnight to 6:00am. How can I add that?

    • Juste MBAMBA dit :

      Hi Danny. So you want to pass the phone to Airplane mode during a specific time. I believe the best to that is to create a separate profile that shuts all data connection.
      Contexts: time (between 12:00 and 06:00)
      Entry task: Airplane mode
      Exit task: a vocal sound to wake you up like a « say action ».

  12. Jimmy dit :

    So I tested both profiles separately. The WIFI Stopper seemed to be fine.

    I found that the WIFI Starter caused the issue. It actually causes the force close, but very shortly after the wifi turns on. So it does it’s job, but then force closes.

    Though, after further testing…I found that the force close ONLY happens if I’m actually using the phone. If the phone is in sleep mode/standby, the WIFI Starter seemed to work fine with out a force close.

  13. Justin Blankenship dit :

    @Juste MBAMBA, I tested the profiles. It does seem like the issue is with the Wifi Starter profile. If I remember correctly, it was also when I returned to my house that I got the FC error before, but the Wifi did in fact turn on…a bit weird I guess.

    However, I have set the Wifi Sleep Policy to Never in settings. We’ll see how it goes from here.

    Thanks for troubleshooting this with us! When we get all the small wrinkles ironed out, I believe this will be one of the most useful profiles yet.

  14. Justin Blankenship dit :

    @Juste MBAMBA, Also the issue with the Wifi Starter seems to be that it always Force Close’s when triggered to use. The Wifi did not automatically show to be connected (in notification bar) until one of my programs which needed data transfer began updating or refreshing. Until that point, the 3G seemed to still be on, in my house that is.

    Also, would it be helpful if when it Force Closes to add the specific log notes?

    • Juste MBAMBA dit :

      Justin and Jimmy, thanks for doing the tests. It seems clear the FC happens (often) with the WIFI Starter, and probably is linked to the cell tower. There seem to be quite a few FC issue depending on tasker utilisation. Is it possible that both of you file a case here: http://groups.google.com/group/tasker. With the specific tests we have done, Pent should be able to fix the bug.

  15. Radioman dit :

    Thanks for the scripts. It’s working very well.
    SE X10

    Cheers // Radioman

  16. Danny dit :

    @Juste MBAMBA, I was really looking for a way to disable Wifi Start/Wifi stop at night and not put the phone into airplane mode. I still want to be able to get calls. I was just wondering if the was a way to have wifi start/ wifi stop profiles only work from say 6:00am – 11:00pm. And then I could add another profile to disable wifi and data also.

    Thanks

  17. Haddock dit :

    Hi! I have been using WiFi near to do this, but welcome this method. But I cannot open the two profiles (wifi starter and wifi stopper) with Tasker. I could open all five tasks, but not the profiles. Any idea why? Or any idea of how to get around this? Thanks!

    • Juste MBAMBA dit :

      Hi Haddock (Captain?)! I’m happy you managed to download the tasks. What happens when you click on the profiles links? Do you have a text on the screen? an error message? Also, are downloading directly from the phone or from a computer?

  18. Haddock dit :

    Yes, the Captain ;-)
    I can click and download the profiles links from my phone, and they can then be accessed from the status bar(just as I did with the tasks). But when I click on them, it says that Tasker cannot open the file.

    • Juste MBAMBA dit :

      Hola Captain. Can you tried to access the downloads folder from Tasker / import?
      Otherwise, try to download from your computer.
      What is you tasker version / android version?
      Cheers.

  19. Haddock dit :

    I cannot access the files from tasker either. And when I download the files from Firefox on my computer, they don’t appear in the designated folder, even though they appear in firefox downloads. If I succeed in downloading them to my computer, should I just transfer them to the tasker folder on my phone?
    I have the newest tasker update (v. 1.0.16m) and I am using Froyo (2.29.405.2 Sense) on an HTC Desire. Tasker still says « Sorry, this content cannot be handle by Tasker »

    • Juste MBAMBA dit :

      I must confess that I have no idea of what is happening. I suggest you do the downloads on the computer and then transfer them on your phone. On firefox, a right click at the correct place should reveal where the downloads are stored. Try and let us know.

  20. Abe dit :

    Hi, I really love these profiles and tasks but I need help with just one thing. I keep getting an error stating « task doesn’t exist:Wifi Checks Init » please anyone who knows how to fix this please help me out
    _thanks

  21. Haddock dit :

    Hi Juste. I managed to install the profiles from my computer, and I have taken the steps as described above, so now I hope it works! Thanks for all of your help!
    PS: When at home, tasker doesn’t show WiFi Starter as an active profile, but wifi is on. Is that how it should be?

    • Juste MBAMBA dit :

      (Captain) Haddock, I’m glad you succeeded. And indeed, your setup seems to work perfectly. WIFI Starter is only active to launch the WIFI. When it’s done, the profile is no more active. That’s where we manage to reduce battery usage! :)

  22. Jeff dit :

    How do I set up the Wi-Fi Check script to include multiple WiFi networks?

  23. Lance Muller dit :

    I really appreciate the effort but next time pretty please think a little bit more about how you name your variables.
    « WIFII » with two « I » is the best you can come up with?
    « MYWIFINET » is almost the only variable with a proper name.
    The « WiFi Starter » starts with the condition %WIFI matches « on » and you labeled it with « WiFi Off »?
    In the end it probably works but you made it really hard for a casual programmer to evolve this program into his own profiles and tasks.
    Maybe I’ll give it another got but

    • Juste MBAMBA dit :

      Lance, thanks for your feedback. Your grievances seem to be essentially about the organization of the tasker plateform, its built-in variables and conditions structure. I can only suggest you do 2 things: 1- learn more about tasker and may be start with basic profiles, 2- share your feedback with Lee Wilmot, the brain behind tasker on this dedicated space http://groups.google.com/group/tasker. And by all means, if you have a simpler way to automate wifi with tasker, please let us know by posting a profile in the tasker wiki.
      Happy new year.

  24. Mario dit :

    Since a week I own Tasker and I’m learning everyday, although the tasks I’ve made so far are really basic. When I saw this profile on the Tasker-wiki I decided this is a must have (since for me it’s much too advanced to come up with it myself :-) )! I’ve implemented the dual network solution (@work and @home) described earlier on. You described for the Wifi starter part that when you scan in the context « cell near » that tasker replaces the current values. In my case that wasn’t true; the new cell towers were appended to the existing ones. Perhaps it has to do with the current version of tasker (v 1.0.16) that this is changed ?

    I’m thinking about expanding the profile with a task like « say Welcome at home/work » when the Wifi turns on to make it really geekie :-)

    Thank you for this great profile !

    • Juste MBAMBA dit :

      Hi Mario. Congrats for nailing the stuff in less than a week. I should probably try this 1.0.16 version, it sounds pretty cool.
      I’ll let the speaking part up to you, but my guess is you can add a « say action » to the exit task of the … wifi stopper (with a condition on wifi on).
      I have a say have with I flip my phone upside down at night saying « It is xx.xx. Goodnight my friend, it has been a good day! ». I confess it is geekily fun!

  25. Mark Howard dit :

    Many thanks! I spent days looking for such an app to do just this. Kudos to you!

  26. Kenny dit :

    Hi Juste MBAMBA,

    Sorry if my question is not related to your post.
    I just purchased Tasker and was trying to do a simple task that
    automatically turn on/off the wifi when I’m at home. All I do is:

    Contexts | Tasks
    Cell Near | Turn On Wifi
    Wifi Near | Turn Off Wifi (Exit task) (optional?)

    I also have another profile that simply turn off the wifi when I lock
    the screen.

    The problem is that whenever I unlock my phone, the wifi is connected
    correctly to my home wifi, but after likes 10-30s, the wifi turn
    off itself so my phone back to use 3G network, and after 1-2min it
    reconnect itself to my home wifi again, this seems to happen again
    and again? So what is the problem here? Hope you can help me.

    Thanks

    • Kenny dit :

      I use Samsung Galaxy S I9000. Android version 2.2.1. Tasker version 1.0.16m.

      Thanks

    • Juste MBAMBA dit :

      Kenny, that’s a strange behaviour. Let see if others have ideas about it. I must confess I spent sometime playing with wifi near but couldn’t understand the inner rules, so I decided to build the automator.
      It seems your profile cutting down wifi at screen lock is executing only when you unlock the screen. You muat note that for battery saving, tasker stops monitoring a few context like orientation or gestures. Can you describe your wifi stop profile?
      Why do you turn off wifi anyway? I uses less battery than 3g scanning. Whatis your wifi sleep policy? Can you try to set it to never and see how it plays?

  27. Juste MBAMBA dit :

    Happy new year to every one.
    For future comments, can you please indicate your device, android version and tasker version? It will give us a good idea of where the plugin is used.

  28. JP dit :

    I like your wifi script. It has helped the battery life on my Droid Pro quite a lot. I do have one question. My work email, due to certain security protocols, will not allow me to send messages when connected to my home wifi network. I had written a simple task to disable my wifi when entering » Mail » and re-enabling it upon exit. However, with your script running my wifi reconnects during mt email session and then causes my messages not to send. Is there a way to prevent this or can I incorporate something into your script to keep wifi off while » Mail » is openand reconnect after close? I look forward to your advice.

    • Juste MBAMBA dit :

      Hi JP. That’s an interesting case. To solve your mail issue, you should do this in your complementary profile: in addition to disabling wifi, you should also deactivate the profile WIFI Starter with the action « Profile Status ». And of course, in the exit task, add the action « profile status » to reactivate the profile.
      Let us know how it works.
      Btw, what’s your phone / android version / tasker version?
      And finally, it’s curious that your security policy doesn’t work on WIFI, as a VPN can take care of its own security.

  29. SHANEL dit :

    I really like these profiles and tasks, but I have a problem

    Should I manually turn 3G on?

    Wifi works fine, but 3G doesn’t work.

    Android version 2.2, Tasker version 1.0.17m.

    Thanks

    • Juste MBAMBA dit :

      Hi Shanel. I’m not sure I understand your question well. But here are a few guidelines: wifi and 3g/edge are not functionning at the same time on android phones. At a given moment, it is either one or the other. So if your phone reverts to 3g when you are out of your home, you should be fine.
      Let me know if that helps. If not, please give more info about your case. Cheers.

  30. Dustin dit :

    Hey! Thanks for the profile, it works great. Is there a way that I could use the same settings to turn on a certain app when i leave my house.

    • Juste MBAMBA dit :

      Glad it works well for you. What app do you want to launch when you leave home?
      Well, it should be possible to use the WIFI profile to do what you want, if we consider that when the wifi is not connected, you are outside. With this consideration, you will just have to edit the WIFI Stopper exit task, to add an « start app » action with the condition WIFI Off.
      I have no idea of how the application will behave if there is a « start » instruction when the app is already running. Try and let us know.

      • Dustin dit :

        Thanks for the response. The app is called Smart Places. It works fine. The app is not effected if it already running. Thanks again!

        • Juste MBAMBA dit :

          :) Good for you! I notice that it’s a place. So it must be making regular calls to GPS? If that’s the case, you can simplify you WIFI management with a GPS location profile only. It won’t save batterly life but will make all WIFI handling more straightforward.

  31. Mark dit :

    I like the concept you’re working with as the wifi near state won’t be constantly draining battery. I am hoping you can help me adjust to handle the following:
    I want the wifi on at home and off at work. I also want other audible settings off at work to be on vibrate normally and silent in meetings (which I can pull from my calendar state). So I need some way to know I’m at work without the wifi near, but also when I’m at home …and act differently.

    Here’s the additional catch – I work only 2.5 miles from home. So cell near state has some overlapping cell towers. Do you have any suggestions how to modify or add profiles to what you already have to be able to do this?

    • Mark dit :

      One other thing…my work hours vary from day to day, so a time based setting could risk me having the « DROID » ring go off in important meetings, so that’s why I rely on the work ssid for location. Unfortunately, my company won’t let us connect to the wifi on our phones unless it’s a company supplied crackberry, or I’d leave wifi on.

  32. Mohd Nazri dit :

    Juste MBAMBA, just want to understand if let say cell near detect my current cell, it will activate wifi right? and why do i need to put SSID under wifi ap search? as i understand, when wifi is on, it will detect whatever wifi signal that it found and connected to it.
    thanks!

    • Juste MBAMBA dit :

      Hey Mohd. Indeed, when you enter your cell tower area, the WIFI Automator starts the WIFI. In most situations, it is ok to do that. But, when you are in cell tower coverage area, but not at your home / SSID location, we don’t want your WIFI to stay on and keep looking for APs. So if your WIFI doesn’t connect after 45 seconds (standard timing in the task WIFI Stop 2), we cut WIFI down IF your home SSID is not detected. This will allow you to drink 4 beers (may be more) at the corner bar without having your WIFI on for the 3 hours of the drinks.
      Let me know if you have more questions.

  33. Mohd Nazri dit :

    Another thing I notice that, if I manually activate wifi while i’m not at home, wifi stopper will start and shutdown my wifi connection. is there any way to prevent this?

    Thanks!

    • Juste MBAMBA dit :

      ?) Well, when WIFI is on AND not connected to any AP, WIFI Stopper is fired. It gives you 45 seconds to connect to an AP and if there is no connection after that time, WIFI is stopped to prevent unnecessary battery use.
      If you need more than 45seconds to connect to a new AP for example, you can temporarily disable the WIFI Stopper profile. If your WIFI AP takes more than 45s to connect, you can edit the WIFI Stop task and increase the 45 seconds timing. If you want to connect to an AP different from your home, we have discussed that in previous comments (this one and also this one).
      If you have a usage different of these two, let us know so that we can advise properly.

      • Mohd Nazri dit :

        Juste, thanks for the explanation. i try to set up auto sync cycle duration. event when wifi is connected and i set range from 0000 – 2359 and repeat after 5 minutes. on task i set auto sync toggle and exit task auto sync off.but it didnt work. any idea on this.
        thanks!

        • Juste MBAMBA dit :

          Hmmm! Normally, any decent app with the auto-sync feature will have a parameter for the syncing frequency (1hr / 30 mins…push). So it shouldn’t be necessary nor advisable to toogle auto-sync on and off with Tasker. What app are you playing with?
          If you still have to manage auto-sync yourself, let have a look at your profile. Given that you want the profile to run all day (0000-2359), you don’t need to specify the time range in the profile contexts. Apart from these comments, we need to look at the specific app you are toggling on and off to debug.
          Let us know.

      • Mark dit :

        I do have a different need similar to this. I posted in a different thread, but never got a response.

        I want to be able to recognize the second location, but not start wifi. Instead I want to trigger a different profile in tasker that sets settings for work. It will also need to be able to know when I’ve left. Can this be done using %WIFII and %MYWIFINET check, or do I need alternate method? I work about 2-3 minutes from home.

        Rooted, cyanogen, Moto Droid 1

        • Juste MBAMBA dit :

          Interesting case. Dude, it considered it through and fro. In the end, you can do this:
          – have a master profile based using a network location context to identify when you are « near work » that can control a variable %nearwork that will start the checks (see below). This variable can be setup using the same logic of varying time intervals as in the WIFI Automator: before reaching the office, check every 3 mins for 15 mins, then every 30 mins for 1hour,….
          – have an « AtOfficeChecker » profile with two contexts: a variable value context « %nearwork » and a GPS location covering +/- 50m your workplace. When you are at the office, a task will do the settings and set the %nearwork variable to « atwork ».
          – With the value « atwork », the masterprofile should check every 30mins or 1hour (depending on your moving frequency) if you are still at work. Simply said: every 30 or 60 mins, replace the %nearwork to a search value.

          How does that sound to you?

          • Mark dit :

            First, I need to thank you for mulling through my situation. It has wracked my brain as well.

            I’m not sure if I totally understand. I would have to mirror what you did with timing variables so I’d have to make use of some similar to %MYSTART, %MYLAPSE, %MYCheckStart, %MYCheckDur, %MDurWL, %MDurWL1, %MDurWL2, %MLapWL1, and %MLapWL2?

            Then I’d add a %nearwork and a master profile that uses a normal (with wifi or not?) network check location context to manage the cycling and another profile that triggers on a separate location context using GPS and having the %nearwork variable set to « atwork » (or 1 or true)? Is this correct (the looping part is probably going to mess me up)?

            Also, I’ve found that while using the existing profiles at work, I am close enough to home that the cell towers overlap. So the WIFI Starter keeps triggering depending if those towers are the active ones. If I exclude these towers though, then it doesn’t always trigger at home.

            Finally – I do know the wifi SSID at work if that makes it easier to determine « atwork » instead of the GPS / Network location contexts. We just don’t have credentials to connect to it with our personal cell phones. Would that change your suggestion?

          • Juste MBAMBA dit :

            Man this case can become quite complex. Do you move in and out of your office building very often? And also, what is your android version?

            The fact that there is an SSID at office and that celltowers overlap make me think of another suggestion. Basically we can think of editing the WIFI Automator a bit. In the WIFI AP Search task, you can add an after the checks thats applies the settings if WIFII matches office SSID. It should work but have no idea if it will be of every time. Let me know.

            Also, if you are using gingerbread, it might worth to use profiles relying on GPS Location, as it tend to be extremely responsive on gingerbread.

          • Sasha Berkman dit :

            « Also, if you are using gingerbread, it might worth to use profiles relying on GPS Location, as it tend to be extremely responsive on gingerbread. »

            are you gonna stick to this?

            regards

          • Juste MBAMBA dit :

            Well, I can do much for now on Gingerbread as there is not yet an effective GB rom for the X10. But that is bound to progress in the coming weeks.
            Anyway, any help is appreciated.

  34. Riffey#4 dit :

    Thank you,it seems to be working. Now I have to leave my home to check if it really works ;)

  35. walk2hell dit :

    I dont know why my comments has benn deleted but, I am gonna write comment again. Hello! I really appriciate your great work! but I have one issue,
    everytime I try to import profile. It repeats same error message. Here is the message « Ignoring import task with existing name, plz delete it first ». Can you help me to slove this problem? Ahh one more thing, suprisingly, when I import profile first, not import tasks first, it doesnt show error message. but wifi automaiton doesn’t work.

    • Juste MBAMBA dit :

      :) Your previous comments haven’t been deleted. They were just walking (see the game? :)) their way to the moderator for approval. It is standard procedure for 1st time commenters.
      Now regarding your issue, it seems that the task you try to import has laready been imported. Can you check? For the system to work, you will have to import ALL tasks and profiles AND do configuration step.
      Hope it helps!

  36. skinnyvoice dit :

    Hi Juste, just to say a big thankyou (merci?) for saving me so much work. The profiles & tasks are working brilliantly on my Nexus S. 2.3.2, Tasker 1.0.18

  37. Mohd Nazri dit :

    mbamba,
    how do you set all this variable %MLapWL2 other variable as i can see, this check parameter task never call inside wifi starter profile and wifi stopper profile and also in other task. how do you make it work to set all variable?

    • Juste MBAMBA dit :

      Hi. To set up the variables, you have to run the tast WIFI Checks Params. That’s where you set up the variables. I hope it is the answer you were looking for.
      Let me know. We can start a chat session if you need.

      • Mohd Nazri dit :

        I know that we need to set parameters, but how can task run when context call them?

        • Mohd Nazri dit :

          Sorry, typo error. How can task run without context call them?

          • Juste MBAMBA dit :

            Well, on the startup screen of tasker you can click a button to show the tasks. Then, select the task you want to run. When the said task is shown, on the bottom-right corner of the screen, you have a button Run or Test (i don’t remember the exact name). Click on it and the taks will run.
            This is the method to run tasks manually.

  38. Mohd Nazri dit :

    juste,
    can you explain how variable %TIMES work?I still cant understand how %TIMES work.

    • Juste MBAMBA dit :

      %Times is a builtin variable that gives the current time. %Mycheckstart is used to determined when a WIFI searching cycle starts. If you remember, we staged search process: Staeg one thats lasts at max for 15 mins, stage 2 thats lasts for 1hour,… and you can even add other stages. To know since when the whole cycle started, we compute the difference between %Times (current time) and %Mycheckstart(time at the beginning).

      • Mohd Nazri dit :

        can we reset current time?what time did this times var refer?can you explain with example..
        thanks!

        • Juste MBAMBA dit :

          I know Hiro Nakamura (heroes) can go back back in time :)). More seriously, right now it is 12:02, 03/03/20111. %Times will give you the coded value of 12:02, 03/03/2011. When it will be 12:30, %Times will give the coded value of that moment.

          On tasker wiki, it says this:
          Time Seconds
          %TIMES
          The current time in seconds.
          (seconds since some time in January, 1970, if you must know).

          • Mohd Nazri dit :

            now i understand.
            please have take a look below action. and comment
            i want action 6 to be execute after 30 minutes, and i want it to be invoked if got another task a running

            1.%datat set to %times
            2. wait 2 minutes
            3. go to act 6 if task a on
            4. %dataa set to %times – %datat
            5. go to act 1 if dataa < 60 * 30
            6. action 6

          • Juste MBAMBA dit :

            Hi. It is my opinion that you should delete action and state the last action as « action 6 if task a on ».
            This will give you a running while loop.
            For more info about tasker syntax, you can check the tasker wiki especially the loops part.

  39. stainlessray dit :

    I’ve been using this profile in place of my amateur ‘wifi near’ profile for about 18 hours. Though I believe it will be interesting to extend the reach to include the portions of my yard yard still in the effective range of my router, that is not what is impressing me the most.
    It was just so easy to set up! It seems to be working perfectly. It is far more responsive to the variables set forth here than what i was seeing from the ‘wifi near’ . I created. All the while it cleverly reduces the frequency and duration it is actively searching for the required triggers, and is therefore more power efficient to execute while being more reliable.
    Thanks. Very nice work.

  40. Razor37 dit :

    Great scripts, working well for me so far.

    Just a tip – I added « keyguard on » to Wifi Starter and « keyguard off » to Wifi stopper, so my phone is locked when I am out and unlocked when I am home or at work. I also added « say » commands to each profile to tell me the new wifi state, data state, and lock state.

    Well done!

  41. Dmitry dit :

    Thanks for the profile, Juste. Works fine on my Acer Liquid.

    However, in my case it seems to turn WIFI off when GSM signal in lost.
    Is there a way not to launch WIFI stopper when there’s no GSM signal?

  42. Tim dit :

    This is the best thought out WIFI Automator I have found, not to mention very helpful in the Tasker learning curve.

    +1

    :D

  43. an0therus3r dit :

    I tried to get this script running but for some reason it won’t turn on my Wifi, Wifi Starter is active but not enabling Wifi.
    I also can’t seem to find Wifi Check Params getting called anyware?

    Am i doing something wrong?

    • Juste MBAMBA dit :

      Indeed Wifi Check Params is not called anywhere in the process. You just use it to set up the different parameters. You have to edit it to define at least your network SSID. And then, you have to run that task.
      To finish the set up, you have to edit the WIFI Starter profile and scan you specific location.
      When Wifi Check Params has been run and you have edited WIFI Starter, the key variables are set and your WIFI should be controlled flawlessly.

  44. Sasha Berkman dit :

    works very nice on my HTC desire, thank you

  45. Tim dit :

    Salut!

    Thanks for this. I’m very new to Tasker and my first wish was a WiFi automator based on location as I work a lot from home and don’t want to wast phone contract minutes unnecessarily.

    One thing, is there a simple way to turn the task off at, say 6pm and on again at 6am – even if, at night I am in « Airplane mode »?

    Thanks again,
    Tim

  46. P. Barber dit :

    I’ve just used your profiles to set up my Nexus One and it is running perfectly.

    I then tried to set it up on mt Nook Color tablet running CM7 and am having a problem.

    When I scan for cell towers under Cell Near I get no reading. I have even tried to use the readings from my Nexus One setup and the the profile does not seem to work.

    Any suggestions?

    • Juste MBAMBA dit :

      Hi. I don’t know if you are still in need or if you found a solution. It seems anyway that your problem is due to tasker. I would suggest to report it on tasker bug list.

  47. Rex dit :

    Hi,

    I’m trying to use your WIFI tasker as it seems more consdervative than mine.

    However, whenever I import the profiles, they don’t show up in my profile list.

    • Juste MBAMBA dit :

      Hi Rex. Have you solved your issue? If not, have you managed to download successfully the profiles? That’s the first step. You might want to use a computer for that if it doesn’t play well on your phone browser.

  48. Chris dit :

    Beautiful. Works like a charm. Thanks so much!

  49. Stefan Block dit :

    Dont work on my Galaxy S2. Wifi Starter works but when i leave my home an i out of range from my cells, wifi stays alive and are not switch off. No Profiles are active when i leave my home cells. My Tasker Version is 1.0.21u2m. My S2 is XEU Device with Firmware KE7. Can anybody help me?

    • Ryan dit :

      I had the same problem yesterday. I left the house and the Wifi never turned off. I checked every so often for about 30 minutes and Wifi still stayed on. I have a Skyrocket.

      • Juste MBAMBA dit :

        Hmm! That’s strange. The most basic function of the automator is to cut WIFI when there is no connection. So for your experiment, here are 2 options: either tasker was off or wifi was still connected out of your place?

Leave a Reply