Tasker

Use Tasker to control OpenHAB switches from your Android

On this page

What is Tasker?

Tasker is an automation app for Android. It lets you automate the execution of actions based on triggers like time, location, other apps, ...

In this sample scenario, we won't be using a trigger but just create an action that will let us control a switch in OpenHAB.

The OpenHAB REST Services... kind of

OpenHAB has a REST API that you can use to integrate OpenHAB into other systems (like your own front-end website).

To keep things simple for this exercise, we'll just use a very simplified version where you don't need to post anything. You can find it at /CMD on your OpenHAB site. For example, if OpenHAB is at 192.168.1.80 and you have switch item named KanKun then you can trigger the switch with these URLs:

  • http://192.168.1.80:8080/CMD?KanKun=ON
  • http://192.168.1.80:8080/CMD?KanKun=OFF
  • http://192.168.1.80:8080/CMD?KanKun=TOGGLE

Using Tasker, you can add a widget on your Android phone that you can click to toggle the switch between On and Off. If you have an Android Wear watch, you can even add it to your watch!

Here's how:

Step By Step Guide

Tasker step 1
Step 1: Open Tasker and add a new Task

Tasker step 2
Step 2: Give the Task a name

Tasker step 3
Step 3: Add an HTTP GET Action to the Task

Tasker step 4
Step 4: Use the filter at the bottom to help find the right Action

Tasker step 5
Step 5: Break up the URL into 3 pieces & remember to change the IP if yours is different

Tasker step 6
Step 6: Give the Task an Icon and (optionally) add a second "Flash" Action.
Then exit "Task Edit" by clicking on the Tasker icon in the top left

Tasker step 7
Step 7: Go to the home screen you want to add the widget to and open the widget locker
(in Lollipop you do this by long-pressing on some empty background)

Tasker step 8
Step 8: Click it! Click it again!

A Free Alternative

As user Keralots pointed out on our forum, there is a free alternative called HTTP Request Shortcuts.

It doesn't do all that Tasker does, but if you just want to create shortcuts for your switches then it does the job just fine.

Go Back

Guides