icon_mapGoal Track car real-time. Integrate into HomeSeer and create location based services.

UPDATE March 30th 2013: Because of changes on the GPS Trace website I have updated the script to version (0.4) it is posted below.

UPDATE: Just received a second tracking device, the Xexun TK102-2

HOW?

  • Tracking device
    • Xexun TK102/103 tracking device (see “Tracker” section below)
  • Option 1: Use script with an existing tracking service (see GPS-TRACE.COM example below)
    (I used option 1)
  • Option 2: Create Software that acts as a ‘server’ for your tracking device

Using GPS-TRACE.COM?

hs_track_gpstraceIf you’re using the gps-trace.com service please look at the following script. It allows you to grab your location from the website and put it in HomeSeer devices.
How?

  • Create an account on www.gps-trace.com
  • Make sure your tracker works with this service.
  • Download my gps-trace grabber script (New version 0.4!)
  • Copy script to your HomeSeer\Script directory
  • Create HomeSeer devices (see instructions in script)
  • Modify parameters in script (see instructions in script: easy!)
  • Create event that runs the script every x minutes.

hs_track01
Information

  • NMEA data send by tracker uses this format:
  • $GPRMC,aaaaaa,b,cccc.cc,d,eeeee.ee,f,ggg.g,hhh.h,jjjjjj,kkk.k,l*mm

Where

  • aaaaaa is the time of the fix UTC in hhmmss format
  • b is the validity of the fix (“A” = valid, “V” = invalid)
  • cccc.cc is the current latitude in ddmm.mm format
  • d is the latitude hemisphere (“N” = northern, “S” = southern)
  • eeeee.ee is the current longitude in dddmm.mm format
  • f is the longitude hemisphere (“E” = eastern, “W” = western)
  • ggg.g is the speed in knots
  • hhh.h is the true course in degrees
  • jjjjjj is the date in DDMMYY format
  • kkk.k is the magnetic variation in degrees
  • l is the direction of magnetic variation (“E” = east, “W” = west)
  • mm is the checksum

Next

  • under construction
  • under construction

 

Tracker

One of the most popular trackers are the Xexun 102 and 103 trackers. There’s imitation devices being sold so be careful. I have never seen a product where the documentation is so bad, the amount of documentation versions is so huge (each saying something different) and where there is NOT 1 place on the internet that tells you how it works. There’s a forum with a lot of information: 1 THREAD with 2,500 messages !??

That is why I have setup a small overview of how I configured my TK-103. These instructions will most likely also work for the Xexun TK-102.

Xexun TK 102  This is a ‘pocket’ tracker. Very small, with battery, built in antennas.

 

Xexun TK 103  More for a fixed mount in a car. Has a lot of extras like an external microphone, external antennas for GPS and Cell, ability to close switches remotely etc.

 

Data Connection

For the data connection I ordered a pre-paid SIM card with data. In the Netherlands I found Simyo.nl to be one of the cheapest. They charge per Kb which is very convenient as the tracker doesn’t send large amounts of data. I’m using a 10 euro card for over 1 year now. It does not have international data support.

Links


Comments

Car Tracking — 5 Comments

    • Good question. You may ask the ebay seller of this product. Don’t know if the cellphone datanetwork of this device will work in the US. GPS-trace.com should (for as far as I know) work in the US. It’s location independent.

  1. ‘A LITLE BETTER SCRIPT FOR HOMESEER

    ‘——————————————————————————————————————————————-
    ‘ GPS Tracking integrtation with HOMESEER
    ‘ by DJF3 – https://www.domoticaworld.cominfo@www.domoticaworld.com
    ‘ version 0.4 – Mar 04 2013 – Have to update, current links don’t work anymore
    ‘ version 0.3 – Jan 12 2012 – added link to Google Maps based on the coordinates
    ‘ Mar 15 2012 – Track_U (last update) device now shows days in device VALUE
    ‘ version 0.2 – Oct 24 2011
    ‘ Updated code because of change in GPS trace website. Added debug level
    ‘ version 0.1 – May 10 2010
    ‘ Tracking integration of Xexun TK102/103 tracker and http://www.gps-trace.com with HomeSeer
    ‘ HOW: Create status-only devices in HS and modify the device-codes below,
    ‘ run script with parameter (“Main”)
    ‘ Set strDebug to 1 = writing to LOG INSTEAD of writing to device
    ‘ Set strDebug to 2 = debug level 1 + Maps and more strings
    ‘ Leave Track_MAPdev empty if you don’t want a google MAP with location
    ‘ TODO:
    ‘ – Fine-tune small Google Map in HS device
    ‘ – Add your ‘home’ location
    ‘ – Add ‘what to do when your car was NOT in Home_location but now it is’

    sub Main(byVal parm As Object)

    dim strDebug as String = 0 ‘DJ: if set to 1 NO data will be written to devices
    dim Track_Xdev as String = “G94” ‘X
    dim Track_Ydev as String = “G95” ‘Y
    dim Track_Sdev as String = “G96” ‘Speed
    dim Track_Tdev as String = “G97” ‘Time last seen
    dim Track_Udev as String = “G98” ‘Updated
    dim Track_MAPdev as String = “G99” ‘Google Map device
    dim Home_X as String = “28.2111683333” ‘ Home coordinates X – not used right now
    dim Home_Y as String = “36.431225” ‘ Home coordinates Y – not used right now
    dim GPSuser as String = “XXXXXXXXXXXXXX” ‘ Your Orange tracker username
    dim MapX as Integer = 400 ‘ Google Map Device Width
    dim MapY as Integer = 400 ‘ Google Map Device Height

    dim SeparatorX as String = chr(34) + “,” + chr(34) + “x” + chr(34) + “:” + chr(34)
    dim SeparatorY as String = chr(34) + “,” + chr(34) + “y” + chr(34) + “:” + chr(34)
    dim SeparatorS as String = chr(34) + “,” + chr(34) + “s” + chr(34) + “:” + chr(34)
    dim SeparatorT as String = chr(34) + “,” + chr(34) + “t” + chr(34) + “:” + chr(34)
    dim SeparatorU as String = chr(34) + “,” + chr(34) + “ti” + chr(34) + “:” + chr(34)
    dim SeparatorU1 as String = chr(34) + “}” + “]”

    dim varVersion as String = “0.4”
    dim DataStrng as String
    dim Path, Path1 as String
    dim Track_X, Track_Xdata as String
    dim Track_Y, Track_Ydata as String
    dim Track_S, Track_Sdata as String
    dim Track_T, Track_Tdata as String
    dim Track_U, Track_Udata as String
    dim Track_MAP as String

    varVersion = “DJ_GPS_Track_” + varVersion
    Path = “https://trc-api.wialon.com”
    Path1 = “/wialon/locator.html?u=” & GPSuser

    ‘————————————————————————————————————————-
    Try ‘DJ: get DATA from Tracker website
    If strDebug >1 then hs.writelog(varVersion,”URL=” & Path & Path1)
    DataStrng = hs.GetURL(Path,Path1,False,80)
    If strDebug >1 then hs.writelog(varVersion,”DataStrng=” & DataStrng)
    If Len(DataStrng)=0 then hs.writelog (varVersion,”Unable to get data – check internet connection”):exit sub
    Catch ex As Exception
    hs.writelog(varVersion,”Error at 1-Getting data (” & ex.Message & “)”)
    End Try
    hs.writelog(varVersion,”DataStrng=” & DataStrng)
    ‘————————————————————————————————————————-

    Try ‘DJ: get X data from Tracker
    Track_Xdata = hs.stringitem(DataStrng,2,”units”)
    If strDebug >0 then hs.writelog(varVersion,”Track_Xdata=” & Track_Xdata)
    Track_X = Trim(hs.stringitem(Track_Xdata,1,SeparatorY))
    Track_X = Trim(hs.stringitem(Track_X,2,SeparatorX))
    If strDebug >0 then hs.writelog(varVersion,”Track_X1=” & Track_X)
    ‘ Track_X = Mid(Track_X,4,Len(Track_X)-6)
    If strDebug > 0 then hs.writelog(varVersion,”Track_X2=” & Track_X)
    If strDebug > 0 then hs.writelog(varVersion,”Track_X:” & Track_X)
    If strDebug = 0 then hs.setdevicestring(Track_Xdev,Track_X,TRUE)

    Catch ex As Exception
    hs.writelog(varVersion,”Error at 2-Track_X (” & ex.Message & “)”)
    End Try

    ‘————————————————————————————————————————-
    Try ‘DJ: get Y data from Tracker
    Track_Ydata = hs.stringitem(DataStrng,2,”units”)
    If strDebug >0 then hs.writelog(varVersion,”Track_Ydata=” & Track_Ydata)
    Track_Y = Trim(hs.stringitem(Track_Ydata,1,SeparatorS))
    Track_Y = Trim(hs.stringitem(Track_Y,2,SeparatorY))
    If strDebug >0 then hs.writelog(varVersion,”Track_Y1=” & Track_Y)
    ‘ Track_Y = Mid(Track_Y,4,Len(Track_Y)-6)
    If strDebug > 0 then hs.writelog(varVersion,”Track_Y2=” & Track_Y)
    If strDebug > 0 then hs.writelog(varVersion,”Track_Y:” & Track_Y)
    If strDebug = 0 then hs.setdevicestring(Track_Ydev,Track_Y,TRUE)

    Catch ex As Exception
    hs.writelog(varVersion,”Error at 2-Track_Y (” & ex.Message & “)”)
    End Try

    ‘————————————————————————————————————————-
    Try ‘DJ: get S data from Tracker
    Track_Sdata = hs.stringitem(DataStrng,2,”units”)
    If strDebug >0 then hs.writelog(varVersion,”Track_Sdata=” & Track_Sdata)
    Track_S = Trim(hs.stringitem(Track_Sdata,1,SeparatorT))
    Track_S = Trim(hs.stringitem(Track_S,2,SeparatorS))
    If strDebug >0 then hs.writelog(varVersion,”Track_S1=” & Track_S)
    ‘ Track_S = Mid(Track_S,4,Len(Track_S)-6)
    If strDebug > 0 then hs.writelog(varVersion,”Track_S2=” & Track_S)
    If strDebug > 0 then hs.writelog(varVersion,”Track_S:” & Track_S)
    If strDebug = 0 then hs.setdevicestring(Track_Sdev,Track_S,TRUE)

    Catch ex As Exception
    hs.writelog(varVersion,”Error at 2-Track_S (” & ex.Message & “)”)
    End Try’————————————————————————————————————————-

    Try ‘DJ: get Time data from Tracker
    Track_Tdata = hs.stringitem(DataStrng,2,”units”)
    If strDebug >0 then hs.writelog(varVersion,”Track_Tdata=” & Track_Tdata)
    Track_T = Trim(hs.stringitem(Track_Tdata,1,SeparatorU))
    Track_T = Trim(hs.stringitem(Track_T,2,SeparatorT))
    If strDebug >0 then hs.writelog(varVersion,”Track_T1=” & Track_T)
    ‘ Track_T = Mid(Track_T,4,Len(Track_T)-6)
    If strDebug > 0 then hs.writelog(varVersion,”Track_T2=” & Track_T)
    If strDebug > 0 then hs.writelog(varVersion,”Track_T:” & Track_T)
    If strDebug = 0 then hs.setdevicestring(Track_Tdev,Track_T,TRUE)

    Catch ex As Exception
    hs.writelog(varVersion,”Error at 2-Track_T (” & ex.Message & “)”)
    End Try
    ‘————————————————————————————————————————-

    Try ‘DJ: get last Update data from Tracker
    Track_Udata = hs.stringitem(DataStrng,2,”units”)
    If strDebug >0 then hs.writelog(varVersion,”Track_Udata=” & Track_Udata)
    Track_U = Trim(hs.stringitem(Track_Udata,1,SeparatorU1))
    Track_U = Trim(hs.stringitem(Track_U,2,SeparatorU))
    If strDebug >0 then hs.writelog(varVersion,”Track_U1=” & Track_U)
    ‘ Track_U = Mid(Track_U,4,Len(Track_U)-5)
    If strDebug > 0 then hs.writelog(varVersion,”Track_U2=” & Track_U)
    If strDebug > 0 then hs.writelog(varVersion,”Track_U:” & Track_U)
    If strDebug = 0 then hs.setdevicestring(Track_Udev,Track_U,TRUE)

    Catch ex As Exception
    hs.writelog(varVersion,”Error at 2-Track_U (” & ex.Message & “)”)
    End Try

    ‘————————————————————————————————————————-

    ‘DJ: Set devicestring of MAP device to display a small google map
    Track_MAP = “Link to location
    If strDebug>1 and Track_MAPdev”” then hs.writelog(varVersion,Track_MAP)

    hs.writelog(varVersion,Track_MAP)

    If Track_MAPdev “” then hs.setdevicestring(Track_MAPdev, Track_MAP,true)

    End Sub

  2. Is this script still working for you? I now need to establish a session before getting the location (according to this documentation: http://sdk.wialon.com/wiki/en/sidebar/remoteapi/codesamples/login). I wrote a little PHP service for getting the location after login using this requests:
    1. login: https://trc-api.wialon.com/wialon/ajax.html?svc=core/login&params={‘use’:’youruser’,’password’:’yourpassword”}
    2. get location by operation searchitem (read http://sdk.wialon.com/wiki/en/sidebar/remoteapi/apiref/core/search_item).

Leave a Reply

HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>