Tasker 5.8 and HTTP Request

For anyone who isn’t aware Tasker had a new update come out with quite a few new features, one of which is HTTP Request (from what I can tell all the various HTTP types rolled up into one action).

This was awesome until I had a task kick off and update a state via HTTP POST action triggering two long vibrations on my phone (not something I enjoyed hearing as I was about to hit the bed for sleep). And yes there is a Stop reminding me option with the notification, but I know as soon as I hit that I will never get around to fixing the action to use the new method.

Anyone savvy enough to know how to setup the HTTP Request to interface with OH. Currently the word on the street is that HTTP POST isn’t going anywhere and will continue to work, however as this is something on a computer/device we all know that this has a possibility to be sunsetted.

Current stable version is 5.8.1 and I grabbed it off of the dev’s drop box share as the Play Store hasn’t provided an option to update.

Is that what that was? It happened when I closed the garage on the way to work. Obviously I didn’t get a chance to see what the alert was while driving and I lost it by the time I got to work.

I’ve not tested it but the following should work.

Field Value Comment
Method POST
URL https://myopenhab.org/rest/items/[item name] [item name] is case sensitive name of the Item
Headers Content-Type: text/plain Accept: application/json Put them on separate lines, the Accept may be optional
Body [command] The command to send to [item name]
Timeout adjust as desired, default is 30 seconds

Note that if you have any following Actions or other tasks that care about the return code, the new variable is %http_response_code instead of %HTTPR.

NOTE: This must mean that the updates have rolled out to the Play store as I did get a Tasker update this morning before the double buzz happened.

1 Like

I just tied to create one of my “HTTP POST” actions as the new “HTTP Request” and it worked as posted by @rlkoshak

Here are the settings for the old and the new action.
My server name and port are stored in variables.
I did not need to define Accept: application/json.



@rlkoshak & @christoph_wempe Kudos to both of you, I was missing the ‘Content-Type: text/plain’ as the Header portion (or it just wasn’t clicking, that i need to have that as part of the Header request).

Now on to updating the doco I have on the forums to display both ways - Tasker with myopenHAB.org (Screenshots for tasker)

1 Like

The new method is still not working for me.
I’m testing with “GET” and “FLASH” tasks and all I’m getting is “unauthorized” response.

Field Value
Method GET
URL https://user:password@myopenhab.org/rest/items/[item name]/state
Headers Content-Type: text/plain Accept: application/json
Timeout 30 seconds

Flash: %http_data

“user” is an email address. Is there a formatting requirement? It works in my web browser.

1 Like

I finally had success!
I used the “HTTP Auth” task with “Method: Username and Password” prior to “HTTP Requests” task

Field Value
Method GET
URL https://myopenhab.org/rest/items/[item name]/state
Headers %http_auth_headers
. Content-Type: text/plain
Timeout 5 seconds

Awesome contrib @Dustin_Thurston I do recall reading new auth methods for tasker, but I didn’t actually test it out (have SNMP from a switch providing phone detections).

There were issues previously and was easily resolved if you stored the username/password values in variables within tasker and then put those place within the URL. My email has some periods (which in retrospect I need to go back in time and slap myself for setting it that way, as it has caused me grief with a couple of other things), and I believe they were causing issues with my login to OH cloud from being successful.