Automatically turn wifi off with Tasker

Alberto Piras
Geek Culture
Published in
3 min readAug 13, 2021

--

Some years ago, keeping connections always turned on could drain the battery a lot. Nowadays, this is much less of an issue, with solutions like Bluetooth Low Energy and batteries bigger and bigger.

Anyway, there are settings that the user could turn off when not needed. For example, turning the wifi off when you disconnect from a wireless network could save some battery. Moreover, you don’t need to remember to turn it back on later, thanks to the Turn on wifi automatically feature of Android 10.

In this story, I will show how to turn off wifi after a certain amount of time my phone disconnects from a network. However, keep in mind that this is valid for some other settings.

Step 1. Identify the conditions

The first thing to do is to look for a Wifi Connected state and a Wifi Status %WIFI variable on the Tasker: State A-Z and the Tasker: Variables pages.

On those pages, you can also find all the other settings Tasker monitors. An example is Bluetooth with the BT Connected state and the Bluetooth Status %BLUE variable.

Step 2. Prepare the tasks

I created two tasks: Wifi Off and End Wifi Off.

The first task waits for some time and then turns off the wifi using the Wait and WiFi actions. The second one stops the first one using the Stop action.

Step 3. Create the profile

It is now possible to set a profile with the elements created.

The profile conditions are the following:

  • Wifi Connected state: checks that the wifi is not connected. The invert option is checked.
  • Variable Value state: checks that the wifi is on. If you have issues with this, set the on value to lowercase.

It runs the following tasks:

  • Wifi Off as Enter Task. It runs when the device has disconnected from a network.
  • End Wifi Off as Exit Task. It runs when either the device has connected to another network or the wifi has been turned off.

The Enforce Task Order option in the profile properties must be unchecked for this to work as expected. This way, the Exit Task can complete before the Enter Task ends.

As explained in the beginning, you can use the same approach for other settings too. The screenshot below is an example with Bluetooth.

--

--

Alberto Piras
Geek Culture

Software development engineer at Amazon. Thoughts and articles are my own.