Create your own personal assistent with Tasker (in multi language) + Google Now integration

Basically what I am doing is using the built-in HASS conversation API endpoint to process the text instead of processing it in Tasker. Using AutoVoice, you can set it up so that when you do a voice search with Google, it listens for a keyword. In my case, I set my keyword to “Home Assistant”. Once it hears the keyword, it automatically starts capturing anything that you say after that. AutoVoice saves what it hears in a Tasker local variable called “%avcommnofilter”. I then take that variable (which contains something like “turn living room off”, for example) to the HASS conversation API at http://your-server:8123/api/services/conversation/process in the form of {“text”: “%avcommnofilter”}. HASS then interprets the input and turns the living room group off.

To set up Restask:

  1. Set request type to Post

  2. Set your host.

  3. Scroll down on the settings page and check “Enable custom body”

  4. In the custom body field, enter what you want to post to the API. In my case it is {“text”: “%avcommnofilter”}

  5. Slide over to the Headers tab

  6. Add a header with the name “X-H-Access” (minus the quotes) and the value your HASS front-end password

  7. Test your connection with the play button in the top right corner. If it is connecting you should get a return value of 200 or 201.

1 Like

Hey @broesie,

Thank you for sharing this. I’m starting to play with Tasker and looks interesting.

Quick question. Do you have by any chance an example on how to read a state from a HA entity in Tasker? I’m interested in how to process the json result in Tasker.

An example of like to understand might be something as simple as the current temperature from a forecast sensor.

Thank you in advance!

1 Like

Yep, true :slight_smile:

When something changes, Home Automation will direct send Tasker values. I use Join (Send Tasker Command) in HASS… Then I can do whatever what I want with that value in Tasker… (Just add some automation in HASS)

Also I added today, that I can control it directly from my quick settings. (Android 7.0 and up).

Also if you are super excited, check this post as well, so you can directly control it by using your Quick Settings:

But in your case, if you followed this tutorial, you have made already the most things, so then you need only create your toggle tasks :slight_smile:

1 Like

Thank you for great tutorial @broesie. You convienced me to buy AutoVoice :slight_smile:

I am using HA with Lets Encrypt and DuckDNS…so it’s SSL and my %HASS_HOST is therefore https://myaddress.duckdns.org . Does Tasker work with SSL?

I did all the steps you have written down, but it’s not working for me, I changed ?api=xxxxx to ?api_password=xxxxx as @iantrich has written in his post.

When I use vocie commands, I get a toast notification:
Received possible command: turn on ambient

Which is correct.

My tasker:

I found a mistake. In your tutorial you have written (every time):

- In data / file: {"entity_id":""%HASS_TOPLIGHT"}

It’s one double quote too much, it should be:

- In data / file: {"entity_id":"%HASS_TOPLIGHT"}

It’s all working nicely now :slight_smile:

My mistake… thnx for pointing it out :slight_smile:

@broesie I have a question, since you have a great knowladge of Tasker and AutoVoice.

I am trying to set command filter slightly differently. You gave an example of command filter:
(?<task>.+) my (?<device>.+)

In some cases I don’t need any word between (?<task>.+) and (?<device>.+) (so in your example word my). How can I achieve that? Tried different syntaxes like:

(?<task>.+)(?<device>.+)
(?<task>.+?<device>.+)
(?<task>?<device>.+)
etc.

…but it doesn’t work

It would also be perfect if I could set command filter in a way to check Contains all. I just want to say my command in whichever order, and if AutoVoice recognizes, that my command included (?<task>.+) and (?<device>.+), it would know what to do.

So for example:
task = turn on
device = living room lights

Instead od saying:
Turn on living room lights.

I could say:
Home Assistant, please turn on living room lights.

AutoVoice would know which task to execute, because my command would include turn on and living room lights.

Is it possible to do this?

Hi

I am having trouble with setting a profile up. You said to select “Event” and then checkmark “Event Behaviour” I cannot find “Event Behaviour” I can only find it if I select “State”. Also under “State” I cannot find checkmark “regex” its disabled.

Can you please clarify this?

Thanks.

In old versions, there was an option “Event Behaviour”. Then later on, it was removed. Anyway, you should checkmark “Regex”, it is neccessary. Use context instead of state. Context will act faster as State…
I hope it helps…

Thanks for pointing that out.

I am confused by this line:

Variable set: %HASS_TOPLIGHT to light.living_toplight

“light.living_toplight” where do I get mine from? I am using a mqtt switch to turn on my lights.

That is your entity of your light… you can find that in the dev console…

Thanks.

Did you mean to use context in configuration task instead of variables set?

Context as your profile trigger in tasker, I recommend not using State as profile trigger in tasker…

Hey sorry to bother u but I am getting this error ;

22.51.46/Variables doreplresult: |%HASS_SERVICE%service%HASS_PSW| -> |http://XXXX:8123/api/services/%service?api_password=XXXX|
22.51.46/Variables doreplresult: |%HASS_SERVICE%service%HASS_PSW| -> |http://XXXX:8123/api/services/%service?api_password=XXXX|
22.51.46/Variables doreplresult: |{“entity_id”:"%HASS_KITCHEN"}| -> |{“entity_id”:“switch.kitchen_lights”}|
22.51.46/E prot: http:// serverport: XXXX:8123/api/services/%service?api_password=XXXX contenttype: application/JSON
22.51.46/E method: POST url: http://XXXX:8123/api/services/%service?api_password=XXXX timout: 10000 dataisfile false save null
22.51.46/M ignoring event when disabled: net.dinglisch.android.tasker.VSETUM
22.51.46/M ignoring event when disabled: net.dinglisch.android.tasker.VSETUM
22.51.46/E body isfile: false cont: {“entity_id”:“switch.kitchen_lights”}
22.51.46/E set content-length: 37
22.51.46/E write postBody string
22.51.46/E Input/Output error for http://XXXX:8123/api/services/%service?api_password=XXXX: java.io.IOException: Invalid % sequence: %se in path at index 45: http://XXXXX:8123/api/services/%service?api_password=XXXX

Hey @broesie I managed to sort the errors but when I say “OK Google turn on kitchen lights” nothing happens instead it does a Google search of what I said.

Can you please help me?

Thanks.

Just a quick hint I am using this tutorial in conjunction with the new API.ai component to control everything from my phone. I just replaced

(?<task>.+) my (?<device>.+)

with

ask my home (?<device>.+)

and make an api call to api.ai with RESTTask configuring the header and everything and then parse the answer with a JavaScriptlet and use say to let my phone talk. If anyone wants to do the same let me know.
I find this method somewhat better as I don’t have to make a tasker task for everything on my phone I just need to add new actions to the API.ai site and HA. And the API.ai api can be used from multiple sources (like telegram).

~Cheers

Hi could you explain more in detail?
Do I have to say “OK google” or just “turn on my lights” as nothing seems to work for me :frowning:
Thanks