With this "hack" you'll be able to send voice messages to your Google Home from Tasker, even if your screen is off and locked! This allows you to automate sending messages to someone at home!
For example, you may want to alert your wife that you left your work place and you're coming home
STEP 1 - CREATE REPLY NOTIFICATION
To be able to reply, you'll first a notification to reply to. Here's the trick to getting one.
- On your phone say Broadcast hello to your Google Assistant
- On your Google Home say Reply hello
- You'll get a notification on your phone. That notification has a reply action that you can use in AutoNotification
STEP 2 - QUERY NOTIFICATION
- In Tasker create a Task named Reply Home
- Add an AutoNotification Query action
- Filter by Google app, Broadcast title and Has Reply Action
- Flash %antext1 and %anreplyaction1 just to make sure that you have the values
STEP 3 - STORE REPLY ACTION
If you didn't set the If condition, the %HomeReplyAction variable would get an empty value if this task was ran while the notification was not present. We want to keep the value if the notification is not present.
- Add a Variable Set action and set %HomeReplyAction to %anreplyaction1 but only if %anreplyaction1 is set
This means that if we never stored the value before, we should simply stop the task because it will not work.
- Add a Stop action and set the If to %HomeReplyAction Not Set.
STEP 4 - SET REPLY TEXT PARAMETER IF NOT SET
We want to be able to run this task in 2 situations: standalone and from another task. If we run it standalone, %par1 will not be set. If we run from another task, %par1 can be set to the text we want to send, if that text is set when using the Perform Task action from another task. In this step we'll make sure that if a parameter was not provided, we recognize speech and set it to the recognition result.
- Add an If-End If block with the condition %par1 Not Set
- In the block add a Get Voice action
- Add a Set Variable action where you set %par1 to %VOICE
STEP 5 - REPLY
If you now run the task you'll send a voice message to your Google Home.
- Add an AutoNotification Reply action
- Set the Text to %par1 (which will contain either the first parameter if ran from another task or the voice recognition result)
- Under Advanced set Reply ID to %HomeReplyAction
STEP 6 - SEND TEXT IN BACKGROUND
- Create another task named Test Reply
- Add a Perform Task action
- Set the Task to Reply Home
- Set Parameter 1 to some text you like
- Back out of the task and apply your current settings with the tick on the top right
- Enter the Test Reply task and run it. You should now hear the text on your Google Home!
Now every time you want to send a message to your Google Home simply run the Reply Home task either from a different task to reply from the background or directly if you want to send a voice message!