openHAB + Tasker + AutoVoice

904 views
Skip to first unread message

Ben Jones

unread,
Dec 9, 2013, 5:34:54 AM12/9/13
to ope...@googlegroups.com
Is anyone using these clever apps with openHAB?

So far I have a task setup to 'listen' for voice commands when my screen first turns on (for 10s). During this time I can say 'home' to launch openHAB, 'e-mail', 'twitter' to launch those apps, and 'call wife' to call the missus.

Just started playing around so there is no doubt many other things possible. I.e. only enabling WIFI when you are near to a cell tower close to your house, or disabling the screen lock when you are connected to your home WIFI.

What I would really like to do however, is have Tasker launch specific openHAB commands. I think this is possible with HABSweetie, but not HABDroid, correct?

I will continue to play around with this but just wanted to know if anyone else was further down the track!

Cheers,
Ben

Steve Cliffe

unread,
Dec 9, 2013, 6:23:13 AM12/9/13
to ope...@googlegroups.com
I'm doing this Ben. I use the SendSilentMail Tasker plugin to send a message to my Linux server which pipes it to a script that sends a command to OpenHAB via a REST call depending on the email subject:

case "$msg" in

Home)
        home=1
        curl --header "Content-Type: text/plain" --request PUT --data "ON" $HABURL/Mobile_Home/state
        ;;
Away)
        home=0
        curl --header "Content-Type: text/plain" --request PUT --data "OFF" $HABURL/Mobile_Home/state
        ;;
Charging)
        charge=1
        curl --header "Content-Type: text/plain" --request PUT --data "ON" $HABURL/Mobile_Charging/state
        ;;
Battery)
        charge=0
        curl --header "Content-Type: text/plain" --request PUT --data "OFF" $HABURL/Mobile_Charging/state
        ;;
esac

Till Klocke

unread,
Dec 9, 2013, 6:38:45 AM12/9/13
to ope...@googlegroups.com
Hi,

I recently started using AutoVoice with Tasker (and of course with HABSweetie). It works great, recognition rate is also in an usable range. But I think it is very unelegant to setup a profile for every voice command. How do you guys use AutoVoice? Do you extract variables via regex or something like that or are you also stuck with many different profiles?

Steve Cliffe

unread,
Dec 9, 2013, 6:44:00 AM12/9/13
to ope...@googlegroups.com
Just to clarify, I'm not using AutoVoice - just profiles with email tasks.

Ben Jones

unread,
Dec 9, 2013, 2:02:23 PM12/9/13
to ope...@googlegroups.com
Ok - interesting - I was hoping for slightly better integration than this. 

That is a clever idea Steve, but is there anyway to get Tasker to generate PUT requests directly? 

I am using AutoVoice currently Till, but it involves creating a new profile/task for each launch event. I have HABSweetie and will be testing this out, but I guess only time will tell if we can do anything really clever and eliminate the need for all these profiles!

Thanks for your feedback guys.

Ben Jones

unread,
Dec 9, 2013, 5:07:32 PM12/9/13
to ope...@googlegroups.com
Steve - I was able to get Tasker to send commands to specific openHAB items by using HTTP POST commands (one of the Net actions). I think this will only work for LAN connections as I have external authentication enabled. Probably another reason to use HABSweetie as well, since I am sure that will handle authentication properly.

Ben Jones

unread,
Dec 9, 2013, 5:39:20 PM12/9/13
to ope...@googlegroups.com
Till - I am having trouble with HABSweetie. I can connect to openHAB on my LAN but as soon as I got offsite and try to connect using the external settings I get the red error below popping up;

"Exception occured during invocation of web service."

I am using external authentication, and have entered my username and password (double checked). When I first attempt to connect I get a warning about the SSL certificate, and selected 'trust always'.

My external URL is https://<externalipaddress>:8443. These settings work fine for HABDroid.

Any ideas where I can look to try and diagnose what is going wrong?

Cheers,
Ben

Ben Jones

unread,
Dec 9, 2013, 5:41:37 PM12/9/13
to ope...@googlegroups.com
Further to this, once I get this exception HABSweetie refuses to connect to openHAB at all - even on my LAN. I have to uninstall and reinstall the app to get it to reconnect on my internal address...

Till Klocke

unread,
Dec 10, 2013, 2:40:59 AM12/10/13
to ope...@googlegroups.com
I will have a look into this. A known problem is connections from remote WiFi networks. While the REST-Adapter switches correctly to the remote address, the WebSocket-Connection does not for some reason, and this causes the red popup. A complete uninstallation should be unecessary, even if I have a bug in the settings editor (which is possible). You could also just create a new configuation. HABSweetie supports multiple openHAB instances, each with an internal and external config.

Ben Jones

unread,
Dec 10, 2013, 5:17:09 AM12/10/13
to ope...@googlegroups.com
I did try that (from memory) but the new instance wouldn't save/persist.

I have not been able to get HABSweetie to connect to my external URL yet.

Frederico

unread,
Dec 10, 2013, 10:12:10 AM12/10/13
to ope...@googlegroups.com
Hi!

I am also using tasker to send commands to openHab via http post. Tasker does support https & basic authentication (https://username:password@myPublicAddr:openhabPort) so you can use them to access your "public" openHab. 
I do have a "minor" problem with tasker's post request: apparently openHab processes it but does not answer in a way tasker handles, so I am getting a timeout reading answer. But it is not an issue for now.

Currently I am only sending voice commands to openHab then process them via a rule an getting feedback through an updated openHab item that will have the string used for tasker's TTS action. (kind of prototyping a functionality I'd like to see in habdroid :) )
I am launching the tasker profile (actually a standalone app built from the tasker profile) with a double click in my android's home button (home2 launcher) and I am using if for opening the front gate and to trigger some scenes (arriving / departing home).

Regards,
    Frederico

Ben Jones

unread,
Dec 10, 2013, 3:11:21 PM12/10/13
to ope...@googlegroups.com
Awesome - thanks Frederico. I will try that username/password URL as I would love to control remotely. Would love to see a video or details of how you are getting Tasker to speak the openHAB values!

Ben Jones

unread,
Dec 10, 2013, 8:36:41 PM12/10/13
to ope...@googlegroups.com
Hi Frederico,

I tried this using my login/password in the POST request but I get the following exception when Tasker tries to execute the command;

"SSLHandshakeException: CertPathValidatorException: Trust anchor for certification path not found"

I know HABDroid (which allows me to connect externally) has an option to 'Ignore SSL hostname' which I have checked, but interestingly I don't have 'Ignore SSL certificate' checked - and it works just fine.

Is there something else I need to do to get SSL handshaking working correct? 

If I try this URL in Chrome I get the red screen warning about the SSL certificate names not matching, but if I click Proceed everything works ok.

Cheers,
Ben

Till Klocke

unread,
Dec 11, 2013, 4:19:06 AM12/11/13
to ope...@googlegroups.com
You are probably using a self signed certificate or a certificate signed by a CA not present in the Android keystore. HABSweetie (and I think HABDroid copied my approach), handles Certificates correctly, but allows you to also trust untrusted certificates. Tasker can't currently do that. So every request to a server with an untrusted certificate fails. So except for disabling SSL (which is a bad idea) or buying a trusted certificate (and a domain for this certificate and so on) you won't have any luck getting this to work with only Tasker.

Frederico

unread,
Dec 11, 2013, 5:41:49 AM12/11/13
to ope...@googlegroups.com
Hi!

My setup is a bit different as I am using an outside proxy (with a valid certificate) to access my openHAB installation, so I didn't experience this issue. I believe tasker does not allow you to ignore invalid certificates for http actions. You can apparently implement a workaround via a tasker http plugin or using curl for android to launch the requests: take a look at https://groups.google.com/forum/#!topic/tasker/xQOveCiJbg8 for details.

Regarding your other question about tts in tasker: after the posting the command to openHab, a rule processes the command and updates a VoiceCommandResponse  item . Tasker then GETs the state this item and feed it to it's built-in tts action.

Hope this helps.

Best regards,
   Frederico
Reply all
Reply to author
Forward
0 new messages