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:
Set request type to Post
Set your host.
Scroll down on the settings page and check “Enable custom body”
In the custom body field, enter what you want to post to the API. In my case it is {“text”: “%avcommnofilter”}
Slide over to the Headers tab
Add a header with the name “X-H-Access” (minus the quotes) and the value your HASS front-end password
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.
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.
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)
Thank you for great tutorial @broesie. You convienced me to buy AutoVoice
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
@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.
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.
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…
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.
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).