How to automatically stop charging your phone

It should come to no surprise for those that know me, but I'm a bit of an "Internet of Things" fan. Years ago I caught the IoT bug and I don't see it going away anytime soon. I'm constantly thinking of ways to automate my daily life, both at home and at work. I've been using Tasker for my Android phone since 2010, for everything from saving my battery to automating geo and event-based notifications (my wife appreciates it when my device texts her that I left work). 

Then something called IFTTT (If This Then That) came along and openend up another world of possibilities - letting the layman (ie - non-developer or non-techie) create cloud connections between services and apps that would nornally never be integrated. Yahoo! experimented with this when they launched a product called Yahoo! Pipes but it fell flat because it wasn't something the average consumer could understand how to use - API? What's an API?.

Now, automation is reaching the masses and store shelves. WiFi is popping up in everthing now: light bulbs, switches, security cameras, thermostats, coffee-makers. This enables connectivity to the cloud, which means connectivity to Web hooks, APIs and cloud-based ETL services like IFTTT and Zapier. Simply put: your favorite apps - example: Instagram and Google Drive - can now talk to each other, which means a whole plethera of integration opportunities (commonly called recipes or connections) to help make your life easier by automating the routine stuff you do everyday.

But enough of the background. Let's walk through how to use some of these tools together to help you with something you do on a daily or nightly basis: charge your smartphone. 

The story
As a smartphone user, I want to limit how long my phone charges for so that I don't overcharge my battery. Lithium-ion batteries will perform better and have an overall longer life if they're not always left on the charger (at 100%) or fully discharged (0%).

The solution
In short: an app on my phone (Tasker) will send an SMS "trigger" to the cloud ETL service (IFTTT), which will then take the "action" of turning off the charger by cutting the power to the outlet (WeMo Switch device). 


  1. WeMo switch (around $45-50)
  2. An IFTTT recipe like this (free)
  3. Tasker ($2.99)
  4. Android device (Tasker only runs on Android) 
Steps to create:

Step 1 - Activate WeMo switch on your wifi network

Wemo Switch

Follow the instructions that came with the WeMo switch. Basically, this will include connecting the device to your WiFi network and then connecting the device to the WeMo app (available via Google Play).

Step 2 - Activate the WeMo channel in IFTTT

After you create an account in IFTTT, search for the WeMo channel and activate it. This will link your WeMo switch with your IFTTT account.

Step 3 - Activate the SMS channel in IFTTT

Search for the SMS channel in IFTTT and activate it. This will allow IFTTT to accept SMS messages from your device, to a phone number that they assign to you.

Step 4 - Create the IFTTT recipe that uses the SMS and WeMo channels

Create this recipe from scratch - IF THIS: an SMS message is sent to IFTTT, tagged with #phonecharged, THEN THAT: turn off my WeMo Switch. Or, simply use the recipe that I published and shared below:

IFTTT Recipe: Turn off power with SMS connects sms to wemo-switch

Step 5 - Set up the Tasker profile on your phone

Here are the steps for Tasker. First, create a profile with the state Power-AC and Battery Level 97 to 99. What this means is that when your phone is plugged into the AC outlet and when the battery level reaches 97, the tasks can be executed.

Next, create a task that sends the SMS message to your IFTTT SMS number, with the appropriate tag #phonecharged (or whatever you entered in the IFTTT recipe). You'll notice that in my task, I also added a Say step to give me a verbal queue that the charge is complete. In addition, I also hooked this up to another IFTTT recipe that blinks my kitchen lights, so that I have a visual queue as to when my phone is charged.

To recap the Tasker steps:

  1. State - power - AC
  2. State - charge 97 to 100
  3. Task - phone - send SMS
    1. Number - your IFTTT SMS number for sending SMS
    2. Message - #phonecharged


Finally, check to make sure the profile is active. If you like, you can test the entire recipe (Tasker + IFTTT) by selecting the arrow in the Task Edit screen. In conclusion, this may seem a bit pricy to extend your battery life by 6 to 12 months (or whatever the gain ends up being). However, I consder this fun and that WeMo switch will certainly come in handy for other purposes (think security for lights) if this recipe doesn't do it for you.





Follow Adam