Tasker with myopenHAB.org (Screenshots for tasker)

After learning about how myopenHAB actually works I started working on how to make tasker work with it vs the other solution I provided using telegram-cli. And I think the only two issues I faced were the authentication that is required along with a user agent being needed.

First screenshot is the Profile condition with assigned task:

The green arrow is for when I (and more importantly my wife’s phone) connect to home wifi and the red arrow is for when our phones disconnect from the home wifi.

Now for the complexity of making this operational (1st picture is the original Tasker HTTP Post method, the 2nd picture is for the new method of HTTP Request in Tasker 5.8):

Take note of what I did with the server:port entry, https is required and by using variables I can share this info to help make this easy to explain. While researching what this would take, I couldn’t get a clear idea if you have to put in ascii codes for special characters or if tasker converted things automatically (my login has a period and @ sign to account for). While I’m not going to screenshot my variables, I can confirm that I am not using any ascii codes for special characters it is typed in as if I were logging into the site with a web browser.

As a troubleshooting tip to know if you are properly logging in and updating an item (rather than hitting refresh on the browser and pulling hair out wondering why its not working) setup a flash command after your HTTP Post command and you can leverage built in tasker variables to report the HTTP status code to give you an idea of why the item state failed to update.

I have noticed an issue with my phone and am still troubleshooting it, when I arrive home everything works as intended, however when I leave something is failing and I need to kick off the task manually. Wife’s phone works flawless from what I can tell, so mileage of your profile may vary but the HTTP Post is really the important functionality.


I use variables for username and password too and it occurred to me the other day that I could, and probably should, make the Tasker logic a little smarter and adjust the URL based on whether I’m on the LAN or not. That way I don’t have to go out to myopenhab.org when I’m home and can talk to OH directly. I haven’t spent the time on it yet but will update my original posting or create a new one when I get the chance.

Thanks for posting!


I’m using Tasker exactly that way. You just use Test net action (Type: WiFi SSID) and store result in a variable. Then compare variable value with your WiFi(s) SSID, and according to the result, use local IP or myopenhab.org.

Best regards,

You could probably use %WIFII and don’t even have to use the net action.

WiFi Info
When connected to an Access Point (AP), shows human-readable data about the AP. When not connected, show details of the most recent Wifi scan results for nearby APs.
On Android 8.1+, may require basic location services to be enabled in Android settings.

Just check to see if your desired ssid is in this variable somewhere and you know you are either connected or near your home wifi. You can use something like the following with the Matches Regex:


where your SSID is the name of your AP.


Thank you for the hint. When I was making these tasks, I haven’t invested much time to investigate it thoroughly, and Test net was the first thing I’ve stumbled upon. Your solution is much easier to implement, especially if there are multiple tasks requiring a WiFi name.

Best regards,

Alternatively, you could include entry and exit tasks for the WiFi connected profile which set a variable with the URL. On entry set it to your local ip/hostname, on exit set it to your cloud service. Just make sure to run that task in the exit sequence before any http requests, of course. That way you won’t have to check the WiFi status before each request.

I’m trying to achieve the basic functionality of the OP, but can’t ever get anything but a 401 Not Authorized message.

Well, I assume that the @ in your email address must be encoded as %40 otherwise even your browser won’t be able to force it. I tried to troubleshoot in fiddler, with similar results. If my username is user@domain.com and my password is password, with URL I’m supplying is:


I can see that Fiddler is parsing it into a hash and placing it into an Authorization: Basic header, but I still get a 401.

I can paste the same URL into a browser OK and receive a valid response.

An clues about what might be going wrong here? Is there another header I need to add?

Take a look at my screenshot a little closer, I’m calling a variable in the task; which is how I’m getting around the ascii code symptom.

Yeah, I did notice that and I was also using variables in Tasker before I stepped back to Fiddler to trying and get to the bottom of the authorization issue. However, even if I set my username (email address) as a variable, I still cannot use an @ sign without percent encoding. If I try, I don’t even get as far as a 401 because Tasker cannot parse the URL.

My experience was similar in Fiddler. In the end, I got a workable solution by intercepting a request from my browser and copying the authentication header into a cURL command. This is probably preferable to storing my password in plain text on my phone anyway.

I can confirm that I use two periods and the @ sign in the variable without any issues, perhaps the latest stable version?

Tasker also has a new beta option in the Play store which may have new functionality as Pent has passed the source code along to a new developer.

I can second anonymous.one’s experience. I’ve always used variables and have never used URL encoding for the . or @ and it has worked for at least two years.

Digging this one up! Does anyone know if Tasker can check the state of a item in openhab?

ie: I will mute my music, if connected to wifi and my phone rings but I always want it to check the state is playing, before it mutes it.


You can use http GET method in Tasker to access item state. Enter server address and port, and, in path field enter /rest/items/itemname/state. The result will be stored in %HTTPD variable.

Best regards,

1 Like

Using @davorf’s method it is possible; but its a call done within a script after conditions are met. It sounds like you want to know if music is playing when an incoming call occurs?

Within tasker you would set the condition to incoming call (I would restrict it to groups so only people I want/need to talk to pause the media being played). Within the action then use the HTTP GET to discover the value of your item and reference it to a variable (may want to do a %HTTPD2, just to avoid overriding the default one incase you want to test something else out, personal preference). Then you will also need an exit action to update openhab with the previous state to turn the music/media back on.

Another idea is to have tasker on your phone update a virtual switch in openhab (maybe called phonecall) and have a rule in openhab pause the media and then tasker just updates the switch to off. May require a couple of conditions to avoid music starting up if it wasn’t already running; but this would keep more logic on the openhab side vs the phone side.

Another approach is to use one of the many MQTT client apps/plugins to Tasker that are able to subscribe to an MQTT topic and trigger a Task based on received messages.

Of course this requires your phone to have access to your MQTT broker where ever it happens to be. I use OpenVPN on my phone but there are lots of OwnTracks tutorials for how to safely expose your broker to the Internet or, even better, how to use a cloud based broker like CloudMQTT.

Updated this solution with a screenshot from Tasker 5.8 to support the new HTTP Request action when sending REST updates to OH.

I use mqtt client (a tasker plugin)

It sends a mqtt message to OpenHAB when I am at home on the local lan. I use it to tell OpenHAB to tell me the phone is ringing or a text message sent.

I was trying to get Tasker http request to work with POST but kept getting “401 Unauthorized” error. Then I found this post and added “HTTP Auth” action with username and password before http request action and it worked!

OpenHAB 2
Tasker version : 5.8.3