Saturday, 19 January 2013

Automating WeMo with IFTTT and Tasker for Android

My Android tablet can switch the power on to charge itself. This is the future and I'm living in it!

This solution also requires Google Calendar and a WeMo switch connected to your IFTTT account, which, for now, requires an iOS device for the initial setup.

I expected to easily get Tasker to email IFTTT, but sending a mail from Tasker isn't so simple. Fortunately there's another solution that works.

I'll post a more detailed walk-through if anyone wants it, but here are the basics - if you've used IFTTT and Tasker before you should be able to figure the rest out.
  1. I created a separate (private) Google Calendar under my account called IFTTT. This saves my main calendar from getting cluttered with trigger events.
  2. In Tasker I created a task to write an appointment to the IFTTT calendar with #WeMoOn in the title, and another task with #WeMoOff. (The Calendar Insert action is in the App category.)
  3. Next I created two Tasker profiles, and associated each with its corresponding task:
    1. Battery is 0-20% full and Power is NOT plugged in (both in the State category) - runs the #WeMoOn task
    2. Battery has fully charged (this is in the Event category) and Power is plugged in to any source - runs the #WeMoOff task
  4. Created rules in IFTTT to use the Google Calendar triggers (this) to turn WeMo on or off (that)
Now my tablet will switch the power on if the battery is running low, and switch the power off when it's fully charged.

This assumes the tablet is actually plugged in, so right now it could result in the WeMo being switched on pointlessly if the device is somewhere else. I created a Tasker recipe to check after 16 minutes* whether there's a power source connected, and switch the WeMo off again if not, but that's a bit more fiddly. Let me know if you want me to post it...

*IFTTT checks triggers every 15 minutes, so by this time WeMo should have switched on

EDIT: I've had two more great suggestions in the comments for easier ways to do this. Neither of them quite work for me, but do check them out in case they'd work for you...


  1. Is there a reason you did not use SMS?

  2. Hi Erik, yes - that device doesn't have a SIM so I'd have had to use some other (chargeable) service like Skype to send one.

    But for a device with a SIM, if you have inclusive SMS in your plan, and if you're in a region where SMS to/from IFTTT is supported, then that would probably work :)

  3. An alternative that doesn't come up in simple searches is the Locale plugin "sendsilentmail" which works for Tasker and is exactly what it says. I reproduced the functionality above in about 5 minutes using an email trigger for IFTTT. The "silent" part of sendsilentmail is that it doesn't require interaction at all - no stuffing keystrokes or anything, just tell the plugin what to send and it's done.

    The great news is that email is also an IFTTT "Quick Trigger" so it's executed immediately.

  4. Thanks WeaselChicken, that looks great. I backed out when I saw that it needed my gmail credentials in the app (real shame it can't use native authentication), so I'll stick with what I've got for now, but for lots of people yours would be a much simpler approach!

  5. Wow thanks a lot to both of you TechieBird & weaselchicken awesome tutorial right to the point. Now when i'm connected to the wifi, light open if not between x and x hour.


Creative Commons License This work by TechieBird is licensed under a Creative Commons Attribution-No Derivative Works 2.0 UK: England & Wales License.