Text-to-speech on Mobile with tasker

OK, so I figured it out finally.
You need Tasker and the AutoRemote plugin on your phone. Take a look at this AutoRemote walk through. It’s a little outdated when it comes to my new install of Tasker and AutoRemote, but it is what finally got me to figure it out.

Whenever I want voice feed back on my android phone I just add the following to a rule:

postUpdate(Response,"the master bedroom motion detector was triggered") // Response is a String item in the items file    
callScript("autoremote") 

Here is the Script “autoremote.script” file:

var String url = "https://autoremotejoaomgcd.appspot.com/sendmessage?key=[your-very-long-key-here]&message="

Thread::sleep(1000) // give some time for the Response var to be set

// add the base url to
// the message prefix which consists of the filter word, what to set the voice pitch at (1-10) - used in Tasker Profile
// and what to set the speed of the voice (1-10) - used in Tasker Profile
// note the format that the message needs be in is parameter1 parameter2 parmeter3 =:= message
url = url + "openhab%205%205%20=:=" + Response.state.toString.encode("UTF-8")

// if the LogInfo flag is set on the send the url to the log for diagnostic purposes
if (LogInfo.state == ON) { logInfo("autoremote", url) }

// finally send the url 
sendHttpGetRequest(url)

Here is the description of the Profile from Tasker. Note I added a beep in the task to alert me of the incoming message. I will probabily tweek this in the future

Profile: Event Message From openHAB (11)
Event: AutoRemoteLite [ Configuration:openhab ]
Enter: Say Notification (3)
A1: Beep [ Frequency:8000 Duration:1000 Amplitude:50 Stream:3 ]
A2: Say [ Text:%arcomm Engine:Voice:com.google.android.tts:eng-usa Stream:3 Pitch:%param2 Speed:%param3 Respect Audio Focus:On Network:Off Continue Task Immediately:Off ]

1 Like