My name is Aaron Tinsley

An eclectic collection of thoughts and projects on a variety of (mostly) tech topics.

[Tasker] Control OpenHAB using Android phone or tablet

Mackem phones

Above picture provided by vagueonthehow via Foter.com / CC BY

Introduction

Today, I’m going to show you how to control OpenHAB using Android by using the Tasker app. Some of you may recognize that I’ve already written about this topic (OpenHAB using Tasker), but the method I used in that post had the drawbacks of being complex and requiring a 3rd-party app.  I’m always trying to reduce the “app clutter” on my phone in the interest of saving both my battery and my privacy, so that app had to go!

The method detailed below will allow you to easily control your OpenHAB items.  It will also allow you to retrieve your item states from OpenHAB at any time.  Some really cool things are possible if you tightly integrate your home automation logic between OpenHAB and Tasker.  I have a task that will automatically ask me if I want to turn off my house lights off when I get in my car, but only if my lights are actually on.  The sky’s the limit!

Prerequisites

  • Tasker will need to be installed on your phone (obviously!) Here’s the link if you don’t have it already.
  • You’ll need to download the OpenHAB project file I’ve created to your phone. Here’s the link

Getting started

The first thing you need to do is import the OpenHAB project that I’ve provided.  This will automatically import six tasks that I’ve created into your Tasker.  I’ve created a video to demonstrate how to do this if you’re a total beginner to Tasker.

That should give you a screen full of tasks like you see below.

Control OpenHAB using Android - Project screen
You should have six tasks after the import.

Next, you’ll need to edit the settings to “tailor fit” these tasks to your own custom OpenHAB installation.  Select the “OpenHAB Settings” task and then click on the JavaScriptlet action within it.  There are five settings that you’ll need to adjust.  I’ve highlighted the settings in the below screenshot.

Control OpenHAB using Android - Required settings
Adjust the circled settings and then run the task to save them

After you’ve adjusted the settings to fit your OpenHAB installation, run the task to save them!  You can verify that they’ve been saved by going back to the main Tasker screen and checking the “Vars” tab.

Control OpenHAB usind Android - Vars tab
After you’ve run the OpenHAB Settings task, you can verify they’ve posted into Tasker by checking the Vars tab

That concludes the “setup” portion of installing these Tasks!  Now you can begin implementing your own tasks!

Control OpenHAB using Android

The OpenHAB project you’ve imported has six total tasks: the Settings task, two Function tasks, and three Demo tasks.  You should never directly edit the Function tasks.  They’re designed to be called from other tasks.  The Demo tasks demonstrate how you should write your own tasks, but I’ve also created a quick video which shows how to implement a new task from scratch!  Watch the video below to watch me create a new task to turn my living room light off.

Conclusion

These helper tasks will help you to easily begin integrating your Android phone with your OpenHAB installation, but you may need to play around with Tasker more in order to learn how to perform complicated operations.  So what’s next?  If you’re new to Tasker, I would recommend that you really dive in!  Android Central has a great “Tasker 101” post that will jump-start your knowledge.

Tasker unlocks the potential of your phone!  The first step is to control OpenHAB using Android, but an advanced Tasker user can basically do anything.

6 comments

    1. Glyn,

      I’ve been using Tasker for so long, avoiding this error has become second nature to me. I guess I forgot to mention it.

      There’s a very easy fix to your problem. All you need to do is exit Tasker and it will ask if you want to save. Save, and then relaunch the app. Your task will work after that!

    1. Sagar,

      This method doesn’t use sitemaps for controlling the items. The item is directly addressed. You can control any OpenHAB item regardless of whether it’s on your current sitemap or not.

      Thanks,

      Aaron

  1. Hola! I’ve been following your web site for a while now and finally got the courage to go ahead and give you a shout out from Lubbock Texas! Just wanted to mention keep up the excellent work!

    1. Thanks, Karly! I haven’t had much time lately to work on the kind of stuff I usually post about, but it’s good to know that my older articles are still helping :).

      Aaron

Leave a Reply

Your email address will not be published. Required fields are marked *