Tasker and OpenHAB cloud

I think I posted this over in the myopenhab section but it didn’t seem to get any responses so I thought I might have better luck here.

I’m trying to get tasker to work with the new OpenHAB cloud and openhab2 and thus far have had no success. I set up an HTTP Post action with the following settings:

URL: HTTPS://myemail%40emailhost.com:mypassword@myopenhab.org/rest/items (I made sure to “escape” the “@” and “.” symbols)
Path: FrontPorchLight
Data: TOGGLE
Content Type: text/plain

And I’m having no success. I can do a CURL from linux using the URL I posted above and it works fine, but no success with Tasker. Has anyone attempted this with the new cloud services yet?

Thanks,

Matt

Hi

I’m using:

https://username:password@myopenhab.org:443/classicui

I did also try with rest/items in the past and it didn’t work for me. And one more point: I didn’t replace @ and . symbols. It seems that tasker can handle it :slight_smile:

HTTP Get
Server:Port: See above (I’m working with a variable)
Path: CMD
Attribute: yourItem=TOGGLE

BR
Michael

Great! Thanks for the response. I’ll give it a shot and see what I can make work.

Thanks!

Matt

Hi,

I’m not using the classicui so for me the above didnt work anymore.

Now I’m using HTTP POST to edit items through the rest interface.

This works:
https://username:password@myopenhab.org (you don’t have to escape anything.)

HTTP POST
SERVER:PORT:
see above
PATH
/rest/items/YOURITEM
DATA/FILE
ON or OFF or TOGGLE or a named command (i’m using armed / disarmed for my powermax alarm.)
CONTENT TYPE:
Text/Plain
Leave the rest default

For getting the status in tasker you can just use HTTP GET the same way:

HTTP GET
Server Port: see above
PATH
/rest/items/YOURITEM/state
leave the rest default

You item state will be in the variable %HTTPD.

Just curious to know, why tasker ? when we have rules editor.

I’m using this to simulate my presence (Item AtHome):

Smartphone logged-in to WIFI --> AtHome = True
Smartphone logged-out from WIFI --> AtHome = False

I know that there are other options to do this, but for me it was the easiest and fastest way to run tasker on my mobile :slight_smile:

Tasker is an automation app on android.
I’m using tasker to switch things on or off using my phone in an automated way. Not to edit any rules?

Tasker could automate some stuff, I use it to report my location to openhab, I also use it to turn my alarm on and off, although not automaticly in all cases. Also to query the status of some items.

For example, I made in tasker a persistent notification showing the status of my alarm, and some switches to arm it (or disarm)
see here: screenshot

1 Like

Tasker is a great utility for telling OpenHAB when the phone enters an area (geofencing) or when it connects to a network (presence detection) and for telling OpenHAB when various things happen on your phone. I’ve tried IFTTT but it is EXTREMELY unreliable. Most times it doesn’t even trigger or update anything until I’ve been in the home 5 minutes or more. Tasker always triggers quickly.

The network status doesn’t work for presence detection since most phones now have power saving features that turn off the wifi after being idle for a few minutes and they stop responding to ping requests. So Tasker works perfect for that.

I had been trying Tasker with the new could service and it was not responding but recently they took it down for service and when they brought it back up I tried to input the settings again and now it works! So it looks like the cloud service was modified and now works as you’d expect.

Thanks all for the replies!

Matt

To provide one more example…

As I drive I put my phone on a dock on my dash and when I turn on the car Tasker brings up whatever the last thing I was listening to and plays it and brings up a map for my GPS.

When I get to the corner of my street it pops up a dialog asking if I want to open the garage door. If I press Yes it calls into openHAB to trigger the garage door opener.

Tasker is a way to automate your phone and integrate your phone with your home automation.

I was wondering if there is something I must enable for this to work. I can do a get without any problem but when I try a post, nothing happen. I receive to error in tasker but nothing is working. When using direct openhab url (local) , it’s working perfectly but when using cloud, nothing

Have you set up myopenhab.org including sekret & uuid ?
Does it show as online on the web interface at myopenhab.org ?
Have you setup what items you want to expose to myopenhab.org in paperui ?

Then save, and watch the console logs to spot the connection to myopenhab.org

I like the persistent notification
Could you do a rough or proper tutorial or how you got that working ?
I have working control via tasker, but not live monitoring …

I’m sorry, I currently only have time to do a rough explanation on how to do do it.

I have 3 task that can execute an action on my alarm.

  1. Set Armed througt an api call (and update a variable %Alarm to “armed”)
  2. Set Disarmed through an api call (and update the same variable)
  3. Set ArmedHome through an api call (and update the same variable)

Then make a task -> Alert -> Notify.
Title = Alarm
Text = %Alarm
Icon = choose
Permanent = check
Priority, it depends on what you want, I believe setting this to 1 does not show the notification in the upper bar, but does show when you pull down the notification shade.
Actions:
Here you set one by one the 3 actions I had for switching status of the alarm, label, task and icon.
After this you are finished, in profiles make a profile that triggers when the variable %Alarm is updated, and exectute the above created task.

Note: This relies on your phone setting the variables, so if anyone else sets the alarm, your notification is not updated. I have on my system the pushover bundle configured, so when my alarm state changes, my phone gets a pushover with priority -2 (no notification) with the tasker support in pushover I set the %Alarm variable.thus updating the alarm state to my phone.

I wrote this mostly from memory, I changed my setup to use a quick settings tile in conjunction with my fingerprint reader.

edit:
Come to think of it, I used the http get for a while to get the status of the alarm…
I made a profile to poll the alarm status whenever I turned on the screen, with a maximum of once every 15 minutes, and not when I was at home. So no need for pushover.

1 Like

I was able to make it work from browser directly through openhab cloud, but not from Tasker. Right now Im using internal ip which mean I can’t make it work from internet. I tried using classicui and rest api. Both work local but that’s it. Everything work through my other apps like ifttt, Google assistant, wink, openhab apps… Thank you

This thread was vary helpful to me. I used @derkens information in Tasker and now I can mute all sound appliances (TV, Sound system, etc) when a phone call arrives to my mobile phone. Quite handy as I work from home! I can also enable/disable this functionality from a “Configuration” tab in my OpenHAB ui interface.
I used two items, a simple rule and also added an entry to my sitemap.
Cheers!

I like the idea of a configuration tab, i guess items you check as part of other rules to enable /disable part of the function

@Chod
Exactly. I copy here the rule I use, for your reference.

// This rule mutes all sounding devices when tasker 
// in my mobile phone detects an incoming call.
// The if statement checks the status on the AutoMute item
// to enable or not the mute commands.

rule "Mute all when incoming call"
when
    Item MuteAll received update ON
then
    if (AutoMute.state == ON) {
	    LG_TV0_Mute.sendCommand(ON)
		LG_TV1_Mute.sendCommand(ON)
	}
end

Cheers,
Eduardo

1 Like