Tasker AutoRemote is a slick little Android App that allows you to remotely access your Android device from any Net connected device. It effectively provides you with a URL you can invoke and thereby pass messages to your phone. Those messages can then be acted upon by Tasker.
Once I worked out a few kinks, Tasker AutoRemote became a fun way to integrate remote Linux servers with my phone. Consider the notification from the command line "problem" I worked out a while back. To summarize, I wanted a way to have my computer notify me when a long running task was done. The solution was speak.exe, an AutoHotKey app that uses text-to-voice to get my attention. I can now run the following command locally::
make ; speak "Done compiling. Back to work"
With AutoRemote, it's trivial to extend this example so that I can run:
make ; andsay "Done compiling. Back to work!"
and have the voice chime in over my phone. I don't need to be in front of my computer any longer, and the command works just as well on my local desktop, as it does on a far off remote Linux server.
On the Linux side, I've implemented a general purpose andsend script that invokes my device's URL with arbitrary arguments and content being read from stdin:
#!/bin/bash ## ## Send data to an android device using Tasker's Auto Remote ## tmp=/tmp/andsend.$$ base='https://autoremotejoaomgcd.appspot.com/sendmessage' key='MYKEY' if [ $# -eq 0 ] ; then echo "Usage: `basename $0` command [arg ...]" exit 1 else command=$1 ; shift while [ $# -gt 0 ] ; do command="$command $1" ; shift done fi echo -n "$command=:=" > $tmp cat >> $tmp curl -s $base -d "key=$key" --data-urlencode "message@$tmp" > /dev/null rm -f $tmp
I've then setup a number of wrapper commands that invoke andsend. Here's andsay's:
#!/bin/bash andsend "Say"
And here are the scripts for andclip, which stores text in my Android device's clipboard and andsms which fires off an SMS to a number of my choice:
-- andclip #!/bin/bash andsend "SetClipboard" -- andsms #!/bin/bash if [ -z "$1" ] ; then echo "Usage: `basename $0` phone-number" else andsend SendSms $1 fi
It's all pretty basic stuff. I'm leveraging the convention that AutoRemote uses that messages have the format: word1 word2 ...=:=arbitrary text....
Most of the magic happens on the Android side of things. And even then, the profile to implement andsay is pretty trivial. Here's the Tasker description for it:
Profile: AutoRemote, Say (35) State: AutoRemote [ Configuration:^Say (regex) ] Enter: Anon (36) A1: Say [ Text:%arcomm Engine:Voice:default:default Stream:3 Pitch:5 Speed:5 Respect Audio Focus:On Network:Off Continue Task Immediately:Off ]
With this in place, I can type the command in my office, to be run on a server in Denver, and be notified of the task completion while I'm making lunch in the kitchen. Life is good!