Teltonika NMEA Forwarding

!!! Now on GitHUB !!! https://github.com/G4Cab/TeltonikaNMEAlogger

Hi there,

i’ve got an Teltonika RUT850-GNSS

is there a way to use the GPS-Data of it?

Okay, got a solution myself.

i logged in via ssh on the router and wrote a little shellscript: https://github.com/G4Cab/TeltonikaNMEAlogger

This script should be able to run on any distribution with gpsd and gpsctl commands.

I put this line in my /etc/rc.local

/root/phonetracker.sh &

so it runs every bootup automatically

Hi G4Cab,

that is a cool solution. I want to do the same but I have the problem, that the curl command is not working. I thought every thing is fine, but I get “null” as a response. I tried the command in the browser with all parameters and also got “null” as a response.

Does anyone have an idea, what I am doing wrong? Does I have to configure something in Phonetrack? The device and the session are existing in phonetrack. Thanks for your help.

If everything worked, the “null” response is correct, cause no error happened.
Look at your Phonetrack map. should be some entrys

Thanks for the quick response. Good to know that the “null” response is a good sign. But in my phonetrack map or in the statistic is no entry. I already tried a lot of combinations and missed out some parameters but no success.

Did you precisely copy and paste your token and devicename?

If i look at your screenshot, i don’t see your session token after /gpslogger/

You could test it like this:

https://xxxxxDOMAINxxxxx/nextcloud/index.php/apps/phonetrack/log/gpslogger/xxxxxYOURTOKENxxxxx/xxxxDEVICENAMExxxxx?lat=10&lon=10&sat=10&alt=10&acc=10&speed=10&timestamp=20200524170000

Hi, yes this was my mistake. I took the name of my session instead of the generated token. This makes more sense now. And while finding out I changed to this URL:

https://your.server.org/NC_PATH_IF_NECESSARY/index.php/apps/phonetrack/logGet/TOKEN/DEVNAME

because this was recommended in the documentation. But I guess there is no difference.

Now it works fine. Thanks!

That’s nice to hear.

Hi,
Sorry, I updated your bash script and updated some things in the past few weeks:

  • Removed spaces from the string (after the update the script stopped working for me).
  • Dumping GPS coordinates to file when the modem is offline. (had a lot of gaps in my logging)
  • Upload GPS coordinates from the log file to Nextcloud once the connection resumes and remove the file.

If someone can make the code cleaner or better please do, it was my first bash script since ages.

you don’t have to apologize, my script is and was a quick and dirty one without any fault recognition, and until now, i didn’t think on updating the script ^^
your idea with writing into a logfile is good.
you should consider to use a watchdog address (make a ping to your nextcloud server) instead of checking the ip address. you could have an ip without internet connection :wink:
and second, i wont use a file into the root directory, use /tmp or you may run into a full storage space, you shouldn’t use FILE as variable, use something like OFFLINELOGFILE

Ok, so i created a github repo for the script, so it’s easier to maintain :wink: