Tasker with myopenHAB.org (Screenshots for tasker)

Tags: #<Tag:0x00007f6ce8cac4f0> #<Tag:0x00007f6ce8cac3b0> #<Tag:0x00007f6ce8cac248>

(anonymous.one) #1

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:

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.

(Rich Koshak) #2

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!

(davorf) #3


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,

(Rich Koshak) #4

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.

(davorf) #5


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,

(Kjetil Volden) #6

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.