Locator app with rest Api

Hi All,
I made a small tracking app for Android with a Rest Api client for Openhab.
I’m using it to start a scenario when I come back home and for switch on/off the presence item when I’m in/out.
Because the app, when the tracking mode is on, it’s always up, I added some other features like sharing the position with history that can be useful if you need to tack a family member, or if you forget the car parking place.
Please feel free to try it and send me a feedback.
This is the app link (it’s a beta version): Locator with rest api


Feel free to build your own, but are you aware of owntracks and the owntracks binding?

The simplicity of an app that directly updates OH items is very appealing.

Note that the Mqttitude binding has been replaced with the GPSTracker Binding.

Hi Marcel,
yes, sure I installed and used owntracks, but I wasn’t able to have coming back home procedure that works good. It’s for sure my fault to do the right configuration, but for that I decided to do this app that does not use any binding, neither registration, email etc…
It’s very simple, it needs only the server address and port, username, password and two points (one exactly for the home position and another for a point 100 mt. far for it), that’s all.
For me it works very good, so I decided to share it.
I hope someone can find it useful.




Thanks for creating this app.

Can you give an example of the syntax for filling in these two fields please?


Do they need the full path with the Item name, or just the Item name?

I’m assuming that the internal and external URLs just need to be the hostname & port.

Yes, sure:
you are right, in Internal and external URL, just the hostname and port in this manner:

where is the server address and 8080 is the port of openhab web interface

In case of external server, you have to use the public IP or DNS name like:


rest api user and password are the openhab user and password

in Rest Api Presence:


assuming you defined a switch for presence that is named Nik_Presence in openhab Items
of course you can define more switchs presence items each for any member of family

In Rest Api Back Home:


assuming that you defined a switch that fires a scenario when you come back home.

1 Like

Thanks :slight_smile:

That’s excellent :slight_smile:

I’ll be giving it all a go when I get back home.

Could you add that kind of information to the Google Play page too?

Many thanks,


Yes, I’ll do it.
Don’t forget to set the 2 points on settings menu, one for a point 100 meters far from your house and one exactly in your house.
In the log menu you can see what happens and when the events are fired.

1 Like

Just a thought…

Does your app support the https://myopenhab.org URL?

I don’t know, because I don’t use it, but I think that it probably works if it uses the standard rest api.

1 Like

It would be better if a gps tracking is integrated in the official openhab app… without additional app…

I have integrated https://www.traccar.org/ to track both vehicles and phones. It uses rest api, it has geofence feature and integration to reverse geocoding cloud services. I run it on R-PI. It’s a reliable server but not as simple as your solution.


Hi Robert,
it seems very cool!
What brand/model of device do you use?
Thank you!

I run Teltonika (various models, some older one too) though this is my favourite one FMB900. It’s reliable with tons of features but you need to make sure you have the latest firmware installed.

Hi, this seems a great way to achieve what I want – my congratulations for the work you have done.
I have however tested it out today, but with no success. I may have mis-understood what I am seeing though.

I have set up two items in Openhab (PresenceT and HomeT), entered the local and remote url for the server I then in the Apps settings pressed the “click” when at home to enter the Lat/Long automatically, then walked approx. 100m away and clicked for the Presence Lat/Log. Curiously it says the distance is 147m but I am not concerned if that is the distance for presence in the end (I realise that phone locations are pretty rough anyhow at the best of times)

When I start the app its log has an entry ”connection OK” and “Presence set to : ON”. On Openhab the item PresenceT goes to ON, as expected.

I then walked away for over 200metres and nothing more ever happens – no log entries, no change of Openhab states, even though I have gone well away from home and passed through the point I recorded as Presence. I have tried this two more times with the same outcome, no log entries whatsoever after the first start line.

I see a setting for minimum distance for tracking (set to 5m), what does this actually do? I assume it is just logging, but maybe it impacts on how often the app looks at location? How often does the app actually sample location by default ? It appears mine is not seeing the location at all.

One thought is, does the app handle negative numbers for Lat? Many developers do not realise that half the planet is below the equator, so have negative numbers for this value (I am in New Zealand, my location is -37.8xxxx 175.2xxxxxx).

I am running Openhab 2.4.0 and the app is version 1.5, on a Samsung S9 running Android 9

I look forward to your advice.

Hi Alan,
your configuration is correct. I set that the minimum distance to consider “out of home” is 250 meters, so there is an event that not fires up if you don’t walk at least more than 250 meters far from home.
I’m considering to parameterize this distance, but at the same time, I’m trying to make everything simple without too many parameters.
Sure It’s possible to use negative numbers for LAT and LONG.
Please, feel free to ask me for any question,

Hi Robert,
thanks for the reply, It seem also a good device at an affordable price to do some tests, I will try it.
Thank you,

Hi Alan,
I missed to ask you: if you push on the first button in the bottom on the main screen, you will see two arrows that show your history track, make sure that the app is tracking and report correctly your positions and time/date.
The minimum distance for tracking is used to tell the app the minimum distance to track each position change, higher values save battery.

Hi Nichola, thanks for your quick responses.

I am pleased to advise that after further testing the locator is actually working, but with some limitations (or again, possible mis-understandings on my part).

I had expected to have my two items ON when I am at home, then as I travel away from home, the home (HomeT) item go off, then when I have reached (or passed by a little) the presence point, the second item (PresenceT) go off.

Then I assumed when I return home, first PresenceT will come on, then HomeT.

But – what I have found is that PresenceT is behaving consistently just as described above, but HomeT never changes.

The App log has entries like this:

07-04-2019 13:59:55 - trying connecting local Url: http://xxxx:8080
07-04-2019 13:59:58 - Error local Url does not reply: java.net.SocketTimeoutException: failed to connect to /xxxxx (port 8080) from /xxxxx (port xxxx) after 3000ms
07-04-2019 13:59:58 - trying with Remote, retry n.: 1
Remote Url: http://xxxxx:xxx
07-04-2019 13:59:58 - connection Ok,Rest Api Back Home set to: ON

Which look all correct to me, and the Item changes each time this happens (similar logs appear for OFF).

But there is never any log for Home or anything that looks like the App is trying to send an item change of state other than presence.

Does the “Tracking Mode” in the App change this? I have it set to “Share position”, I assume that is correct. , and anything else would just stop the app from doing anything?

I have tried setting the home Lat/Log again a few times, noting that, given typical poor mobile phone GPS performance this will wander around all the time – but that does not change it – even after entering a new Home waypoint in the settings, and turning the tracking off then on, the log shows no update being sent to Openhab.

I look forward to your thoughts.