OpenHab, Tasker and Alexa


(Kris K) #1

Hi All,

I’m trying to get Tasker to auto accept a sip call, when Alexa receives the voice saying ‘Alexa, Answer’

I can create a routine in the Alexa app for this, and set a switch to ON in OpenHab I’m sure. My question is has anyone used OpenHab to trigger a Tasker action to accept the call?

I’m a bit lost on how to do that component. I assume I can just use a Proxy Switch for this and send some kind of call to Tasker using an OH rule

Any help would be great :slight_smile: I’m doing things in reverse i guess, I want to input into tasker before it triggers an action.

Cheers


(Vincent Regaud) #2

@rlkoshak
Oh, tasker guru… Is that possible?


(Rich Koshak) #3

That’s going to be really cool if we can make it work. Can we? :man_shrugging: Let’s see what we have.

Let’s break the problem down a bit:

  1. Can Tasker do something in response to a routine from Alexa? It looks like the answer may be yes Echo Smart Home Tasker Plugin but it is in beta and requires the AutoVoice plugin.

  2. Can Tasker answer an incoming call? Yes, there is a Take Call action.

So it looks like you don’t need openHAB involved in this at all. What do you need the Item for? Is it just an assumption that the communication must go Alexa->openHAB->Tasker?

So let’s look at how Tasker can receive an event from openHAB. This is not so easy or straight forward as you would imagine. The problem is Tasker may or may not be on your LAN at any given time and therefore may or may not have access yo OH and OH have access to it. So we need a way for Tasker to get the events.

If you are using myopenhab.org we can set up Tasker to poll the REST API for a given Item but that is never going to be fast enough to do something like answering a call.

There appears to be an app that will kick off Tasker tasks in response to messages received over MQTT but this means you either have to be using a cloud based MQTT Broker like CloudMQTT (@vzorglub has a great tutorial for setting that up with the MQTT 1.x binding) or have an SSH tunnel set up (I’ve a tutorial for this posted here somewhere) or VPN connection to home. Or maybe not as you may not care if this command works if you are not connected to your LAN.

Finally, you may be able to set something up using Join or more likely AutoRemote. In this approach openHAB would kick off an sendHttpGetRequest or HTTP binding to call AutoRemote to send a command to your phone in response to the Item changing to ON. I’ve used AutoRemote a while I was playing with Google AIY Voice. Scroll down to the “Music” section.

Good luck! Please post a tutorial if you get this working. If you run into any trouble I’ll help if able.


(anonymous.one) #4

This mqtt app has a tasker plugin, I tried it for a bit and couldn’t accomplish something I attempted; but liked the integration with tasker:

Doesn’t help in the scenario of going off your home network, but could be useful for the orig poster.


(Rich Koshak) #5

That’s the same one I linked to in my reply. I haven’t used it so it’s nice to get some confirmation that at least the integration with Tasker worked.


(anonymous.one) #6

Hhhmmm, guess I need to read vs skimming :roll_eyes::vulcan_salute:


(Kris K) #7

Hi Rich

Let me work through your post and see what I can achieve

Ill report back! Thank you!!

PS: The Smarthome Tasker Plugin is out of beta now


(Kris K) #8

Hi Rich,

Cant seem to get very far with this! The phone ringing is actually from a certain app, Zoipher installed. I’m not sure how to get Tasker to recognise the call from Zoipher. Doesnt appear to be anything on line in terms of tutorials that I can find.

I’ve created a Profile that checks for Phone Ringing, from my Doorbell and my Network as being on WIFI, it then links to ‘Doorbell Auto Answer’ as a Task, but the Task is where im struggling.

I did get the Echo Smart home Plugin running but im a little confused on the order required to do things.

It seems i do not need OH2! I assumed i did.

Cheers


(Rich Koshak) #9

I’d look to see if someone has created a Tasker integration or plug-in for that specific app. If not you may be stuck.

The Phone tasks only work with with the phone’s default phone app.


(Kris K) #10

Hi Rich

OK. it seems the AutoApps can help. by using a Swipe Gesture to accept the call but I can’t get that working either ha!


(Rich Koshak) #11

Wait, try AutoInput. It lets you create a task that simulates finger swypes and taps on the screen. I use it to control Audible when in the car. I should have thought of that before.


(Kris K) #12

Im trrying to use Auto Input but am getting no joy. I worked out the coordinates for the swipe and set my Task to AutoInput, swipe with the start/end but it doesnt appear to do it.

When a call is received, the phone pops up Zoipher with a Phone ringing in the centre, theres a few seconds between the pop up so I put a 3 second wait in there, but alas, it wont swipe the accept for some reason :confused:


(Kris K) #13


And


(Rich Koshak) #14

I don’t know how well auto input works with draw over notifications. what happens if you open the app while it is ringing? wait the three seconds, open the app, and then see if AutoInput will work in the actual app.

in my experience, auto input requires repeated experiments until you find something that works. sometimes you never do. and the slightest change in the app will break the auto input task. it’s crazy powerful but very brittle.


(Kris K) #15

Autoinput for a gesture wont capture the screen im afraid.
It only lets you input cooordinates
Too finky for my liking it seems. Ill see what the reddit guys say about getting it going.


(Kris K) #16

I’ve had success , at least on my mobile. My tablet needs upgrading but I can now get Tasker to auto accept the call using a swipe.

Now to figure how how to trigger this Action using a voice command…


(Kris K) #17

@rlkoshak you may know this…

I’ve got the swipe working and auto accepting calls nicely.

I now want Tasker to check if an OpenHab Sensor (gPresenceSensors) is ON using a HTTP get, and only accept the Auto Call if we are home - cause well, no point if we aren’t, it will ring my mobile and ill pickup manually when I’m not home!

I have the following inside my Action, but it fails. Anything a miss? basically a IF condition and a HTTP get, storing the value as a variable.

Doorbird Auto Answer (3)
A1: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A2: AutoInput Gestures [ Configuration:Gesture Type: Swipe
Start Point: 724,1800
End Point: 1420,1800
Duration: 1000 Timeout (Seconds):10 ] If [ %gPresenceSensors eq ON ]
A3: HTTP Get [ Server: Port:https://USER@EMAIL.COM:XXXXX@[192.168.0.3:8080](http://xxx.xxx.xxxt:443) Path:rest/items/gPresenceSensors Attributes:ON Cookies: User Agent:application/json Timeout:10 Mime Type:text/plain Output File: Trust Any Certificate:Off ]
A4: Variable Set [ Name:%gPresenceSensors To:%HTTPD Recurse Variables:Off Do Maths:Off Append:Off ]

(Rich Koshak) #18

That GET will only work when you phone is on your LAN. It will time out otherwise and generate an error I think. So when you are not home it will lock up the task until the request times out which is probably not what you want.

I would separate the HTTP GET into it’s own task and let it poll the OH API periodically and set a variable accordingly. Then just check the variable in your answer task.


(Kris K) #19

Hi Rich I only want it to work on the LAN, because I only want Auto Answer on this device to work on the LAN.

I have the call coming via Ring Group, so it calls multiple devices at once. When this fails, it will still call my mobile when i’m away which is fine.

I will do the seperation though. I did get it working last night by using /rest/items/itemname/state

Cheers!