Text-to-speech on Mobile with tasker

I like the possibility to output voice.
But in my house It’s not the perfect location to use the openHAB-Server as loudspeaker…

So I don’t use the say()-Command.

Instead I use the android app autoremote in combination with tasker.

So I can call an http-request via openhab to submit a string to my smartphone and there its read by tasker.

This works quite well, but it doesn’t look very elegant in the openHAB-rule (It’s a very long url).

Is there a possibility to create a custom function I can use in each rule?

Like sayOnMobile() ?

1 Like

I had a similar problem with my old home automation software… The text box to enter URLs for actions was to short… In the end I signed up for one of those services that lets you create short URL links for long complicated ones…

Worked well but I guess this made most of my actions reliant on an internet connection to resolve the addresses.

I have been considering trying to implement an autoremote action… just trying get my head around the IDE…


I just started playing with this, and it allows you to send autoremote messages and notifications from command line.

pythonremote --message Chrome_Laptop ‘hello mark’

Might be useful…

Hi, can I ask you how you did that?What’s the rule’s code? thank you very much

Install autoremote on your android.
Then open the device-URL on a desktop (shown as goo.gl/ksahdjkah)
there you can configure a notification-url
From openhab-rule your can call

1 Like

Great! thanks a lot

@mashborn Could you give a brief explanation of how you create the Profile in Tasker to receive the text from AutoRemote and have AutoVoice then play it. I’m kind of new to Tasker but have looked at a lot of video tutorials but can’t quite figure it out. First I can’t even get the messages to get to the phone. Then I can’t figure out how in Tasker to take that message and port it over to AutoVoice. I assume you need to configure Tasker to see the pop-up message and send the message text to the AutoVoice app, maybe if a keyword is present like “openhab”.

I was finally able to figure out how to send the notification message to the phone. Now all I have to do is figure out how to make tasker convert it to voice.

there’s the “say()” command in tasker for voice-output.
I use the %arcomm-Variable from autoremote.

I have no idea what I’m doing wrong. I did see that the %arcomm variable was not something I could pick from the list when I built the task called “Say Notification”. Maybe you could export from your Tasker and send me the profile. I can’t imagine what I’m doing wrong. I did just try to make the task to trigger just a beep sound and that didn’t work either. I must be doing something very basic wrong.

Here is my Profiles description exported from Tasker:

Profile: Say Notification (2)
Event: AutoRemoteLite Communication [ Configuration:Communication Types: Notification ]
Enter: Say Notification (3)
A1: Say [ Text:%artext %arcomm Engine:Voice:com.google.android.tts:eng-usa Stream:3 Pitch:5 Speed:5 Respect Audio Focus:On Network:Off Continue Task Immediately:Off ] 

Here is the full XML export

<TaskerData sr="" dvi="1" tv="4.7u3m">
<Profile sr="prof2" ve="2">
<nme>Say Notification</nme>
<Event sr="con0" ve="2">
<Bundle sr="arg0">
<Vals sr="val">
<CommunicationTypes>&lt;StringArray sr=""&gt;&lt;_array_CommunicationTypes0&gt;Notification&lt;/_array_CommunicationTypes0&gt;&lt;/StringArray&gt;</CommunicationTypes>
<com.twofortyfouram.locale.intent.extra.BLURB>Communication Types: Notification</com.twofortyfouram.locale.intent.extra.BLURB>
<net.dinglisch.android.tasker.RELEVANT_VARIABLES>&lt;StringArray sr=""&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;%err
Error Code
Only available if you select &amp;lt;b&amp;gt;Continue Task After Error&amp;lt;/b&amp;gt; and the action ends in error&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES0&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;%errmsg
Error Message
Only available if you select &amp;lt;b&amp;gt;Continue Task After Error&amp;lt;/b&amp;gt; and the action ends in error&lt;/_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES1&gt;&lt;_array_net.dinglisch.android.tasker.RELEVANT_VARIABLES2&gt;%arcommunicationtype
Communication Type
Current Time
Sender Bluetooth Mac Address
Sender Id
Sender Local IP
Sender Name
Sender Public IP
Sender Type
Notification Text
Way the message was sent (BT, Wifi, GCM)
Current Time
Sender Bluetooth Mac Address
Sender Id
Sender Local IP
Sender Name
Sender Public IP
Sender Type
Way the message was sent (BT, Wifi, GCM)
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>CommunicationTypes plugininstanceid plugintypeid </net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
<Str sr="arg1" ve="3">com.joaomgcd.autoremote.lite</Str>
<Str sr="arg2" ve="3">AutoRemoteLite Communication</Str>
<Task sr="task3">
<nme>Say Notification</nme>
<Action sr="act0" ve="7">
<Str sr="arg0" ve="3">%artext %arcomm</Str>
<Str sr="arg1" ve="3">com.google.android.tts:eng-usa</Str>
<Int sr="arg2" val="3"/>
<Int sr="arg3" val="5"/>
<Int sr="arg4" val="5"/>
<Int sr="arg5" val="1"/>
<Int sr="arg6" val="0"/>
<Int sr="arg7" val="0"/>

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    

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 

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

Each of my Android tablets has internet, but I rather messages from OpenHab to my tablets stay on the private network. Is there a way to have OpenHab signal Tasker to say something without going through a 3rd party like autoremote?