1

What I have to do is very simple, I want to use Tasker to ping my Raspberry PI unit when I get close to home.

What I have:

  • An Android 6.1 Phone
  • An ssh server I can reach from everywhere
  • A Raspberry PI unit behind a router at home

I have downloaded tasker, so I can trigger applications on my phone and I have an app to connect to my remote ssh server. My idea is something like:

  1. Have the Raspi periodically check a file on the server.
  2. File is updated with a flag on whether I am close to home or not by Tasker + SSH application on my phone
  3. ????
  4. Profit!

I need some help on how one can achieve 2. or similar. Essentially, I would like to set up tasker so that on triggers it will make my phone execute a script on the server, any hint?

  • Comments on the downvote? Too vague? – Three Diag Jan 15 '17 at 11:40
  • Dev questions are off-topic. If you didn't mention building an app for that, so it's clear that you're attempting to use Tasker, I will of course have my -1 and flag removed. – Andy Yan Jan 15 '17 at 13:12
  • I see. I meant app In a very broad sense, whatever achieves my goal would do – Three Diag Jan 15 '17 at 13:14
  • Done, and also added a Tasker tag for you. – Andy Yan Jan 15 '17 at 14:16
1

So, I've managed. It's a bit clunky, but it does what it should.

Here's whatis needed:

  1. Tasker app (2.99$ on the Play Store)
  2. Connectbot
  3. An ssh server you can control

Tasker checks my position every two minutes, connects with connectbot which triggers a shell script on the ssh server.

Generate a public ssh key without password from Connectbot. Go in the key section, long tap and copy the key. You can then send the key to your ssh server so that connectbot can authenticate passwordlessly.

Create a profile in connectbot with a meaningful nickname (in my case "homeflag"). Select post-login automation and insert which command you'd like to run. In my case I have a very simple script called I_am_home:

echo 1 > /home/user/home_flag

so in connectbot post-login automation I would put

/path/to/I_am_home; exit ⏎

this ensures the command is triggered automatically at login and then the connection is closed.

In tasker create a task to send intent (use the search bar to find it), with the following fields:

Action: android.intent.action.VIEW
Data: ssh://user@host:port#homeflage
Target: Activity

Information on how to do this have been found on this dedicated reddit containing a lot of other info and different way to achieve this.

It is then easy enough to have tasker check your location periodically by making an appropriate profile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.