Building a simple, background app 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: 


Have the Raspi periodically check a file on the server.
File is updated with a flag on whether I am close to home or not by Tasker + SSH application on my phone
????
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?
So, I've managed. It's a bit clunky, but it does what it should.

Here's whatis needed:


Tasker app (2.99$ on the Play Store)
Connectbot
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 &gt; /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.