Protocol gt06 for Tracker TK103A - no battery level and status using WebSocket

unky3 days ago

I have bought from AliExpress tracker called TK103A as it is on below picture.
tk103A.png

Tracker is connected to Traccar using gt06 protocol. Tracker sends status packets 0x13 to server.
My question is how can I read using API Webhook battery level and power status (external power source or battery) of that tracker?
Using API Web I can get devices and position information but there is now battery level and status information in JSON.

Here is attached log from traccar (only status packets - I have cut out other not status data)

2025-05-27 09:00:46  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a130506030001000208240d0a
2025-05-27 09:00:46  INFO: [T0c769d32: gt06 > 31.60.34.195] 787805130002db6a0d0a
2025-05-27 09:05:48  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a134506030001001961700d0a
2025-05-27 09:05:48  INFO: [T0c769d32: gt06 > 31.60.34.195] 78780513001975380d0a
2025-05-27 09:10:49  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a134506030001002e244c0d0a
2025-05-27 09:10:49  INFO: [T0c769d32: gt06 > 31.60.34.195] 78780513002e30040d0a
2025-05-27 09:15:52  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a13450603000100439caf0d0a
2025-05-27 09:15:52  INFO: [T0c769d32: gt06 > 31.60.34.195] 78780513004388e70d0a
2025-05-27 09:20:54  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a134506030001005832fd0d0a
2025-05-27 09:20:54  INFO: [T0c769d32: gt06 > 31.60.34.195] 78780513005826b50d0a
2025-05-27 09:25:55  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a134506030001006d54d30d0a
2025-05-27 09:25:55  INFO: [T0c769d32: gt06 > 31.60.34.195] 78780513006d409b0d0a
2025-05-27 09:30:56  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a13450603000100824b2a0d0a
2025-05-27 09:30:56  INFO: [T0c769d32: gt06 > 31.60.34.195] 7878051300825f620d0a
2025-05-27 09:35:57  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a13450603000100970c060d0a
2025-05-27 09:35:58  INFO: [T0c769d32: gt06 > 31.60.34.195] 787805130097184e0d0a
2025-05-27 09:40:59  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a13450603000100ac83560d0a
2025-05-27 09:40:59  INFO: [T0c769d32: gt06 > 31.60.34.195] 7878051300ac971e0d0a
2025-05-27 09:46:00  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a13450603000100c13bb50d0a
2025-05-27 09:46:00  INFO: [T0c769d32: gt06 > 31.60.34.195] 7878051300c12ffd0d0a
2025-05-27 09:51:01  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a13450603000100d65f8b0d0a
2025-05-27 09:51:01  INFO: [T0c769d32: gt06 > 31.60.34.195] 7878051300d64bc30d0a
2025-05-27 09:56:02  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a13450603000100ecc1520d0a
2025-05-27 09:56:02  INFO: [T0c769d32: gt06 > 31.60.34.195] 7878051300ecd51a0d0a
2025-05-27 10:01:03  INFO: [T0c769d32: gt06 < 31.60.34.195] 78780a1345060300010101e4610d0a
2025-05-27 10:01:03  INFO: [T0c769d32: gt06 > 31.60.34.195] 787805130101f0290d0a
2025-05-27 10:01:59  INFO: [T3660a2ae: gt06 < 37.47.137.240] 78780a13010003000100027fa80d0a
2025-05-27 10:01:59  INFO: [T3660a2ae: gt06 > 37.47.137.240] 787805130002db6a0d0a
2025-05-27 10:07:01  INFO: [T3660a2ae: gt06 < 37.47.137.240] 78780a135100030201001aa8d80d0a
2025-05-27 10:07:01  INFO: [T3660a2ae: gt06 > 37.47.137.240] 78780513001a47a30d0a
Anton Tananaev3 days ago

What do you see in JSON?

unky3 days ago

Here are some position in JSON. I see now that battery level and powe status i send every 20 messages. Not in every position.

{"positions":[{"id":55533946,"attributes":{"status":81,"ignition":false,"charge":false,"blocked":false,"alarm":"powerCut","batteryLevel":100,"rssi":3,"distance":0.0,"totalDistance":6144768.05,"motion":false},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-27T18:23:53.321+00:00","deviceTime":"2025-05-27T18:23:53.321+00:00","fixTime":"2025-05-27T18:23:40.000+00:00","outdated":true,"valid":true,"latitude":53.104605,"longitude":17.972394444444447,"altitude":0.0,"speed":0.0,"course":0.0,"address":null,"accuracy":0.0,"network":null}]}

{"positions":[{"id":55534106,"attributes":{"sat":2,"ignition":false,"event":0,"archive":false,"distance":0.11,"totalDistance":6144771.14,"motion":false},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-27T18:28:56.961+00:00","deviceTime":"2025-05-27T18:28:55.000+00:00","fixTime":"2025-05-27T18:28:55.000+00:00","outdated":false,"valid":true,"latitude":53.1046,"longitude":17.972405000000002,"altitude":0.0,"speed":0.0,"course":0.0,"address":null,"accuracy":0.0,"network":{"radioType":"gsm","considerIp":false,"cellTowers":[{"cellId":23422,"locationAreaCode":54502,"mobileCountryCode":260,"mobileNetworkCode":3}]}}]}

Anton Tananaev3 days ago

That is absolutely expected for this protocol. Different message types contain different sets of data.

unky2 days ago

Anton: Great, I did not know about that. Thanks for Your job. Traccar is AMAZING :)

unkya day ago

Anton, I have another problem. My local time is +2h from GMT
Please look at JSON:

{"positions":[{"id":55595543,"attributes":{"sat":1,"ignition":false,"event":0,"archive":false,"distance":0.7,"totalDistance":6161248.89,"motion":false},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-29T13:21:43.145+00:00","deviceTime":"2025-05-29T13:21:40.000+00:00","fixTime":"2025-05-29T13:21:40.000+00:00","outdated":false,"valid":true,"latitude":53.13194166666667,"longitude":18.119139999999998,"altitude":0.0,"speed":0.0,"course":186.0,"address":null,"accuracy":0.0,"network":{"radioType":"gsm","considerIp":false,"cellTowers":[{"cellId":22992,"locationAreaCode":54503,"mobileCountryCode":260,"mobileNetworkCode":3}]}}]} {"positions":[{"id":55595549,"attributes":{"sat":1,"ignition":false,"event":0,"archive":false,"distance":21.55,"totalDistance":6161270.44,"motion":true},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-29T13:21:58.865+00:00","deviceTime":"2025-05-29T13:21:55.000+00:00","fixTime":"2025-05-29T13:21:55.000+00:00","outdated":false,"valid":true,"latitude":53.13191666666667,"longitude":18.11882,"altitude":0.0,"speed":10.799140000000001,"course":321.0,"address":null,"accuracy":0.0,"network":{"radioType":"gsm","considerIp":false,"cellTowers":[{"cellId":22992,"locationAreaCode":54503,"mobileCountryCode":260,"mobileNetworkCode":3}]}}]} {"positions":[{"id":55595557,"attributes":{"sat":1,"ignition":false,"event":0,"archive":false,"distance":177.21,"totalDistance":6161447.65,"motion":true},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-29T13:22:15.295+00:00","deviceTime":"2025-05-29T13:22:10.000+00:00","fixTime":"2025-05-29T13:22:10.000+00:00","outdated":false,"valid":true,"latitude":53.13350833333333,"longitude":18.118863333333334,"altitude":0.0,"speed":30.237592,"course":40.0,"address":null,"accuracy":0.0,"network":{"radioType":"gsm","considerIp":false,"cellTowers":[{"cellId":22992,"locationAreaCode":54503,"mobileCountryCode":260,"mobileNetworkCode":3}]}}]} {"positions":[{"id":55595561,"attributes":{"sat":1,"ignition":false,"event":0,"archive":false,"distance":113.8,"totalDistance":6161561.45,"motion":true},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-29T13:22:27.976+00:00","deviceTime":"2025-05-29T13:22:25.000+00:00","fixTime":"2025-05-29T13:22:25.000+00:00","outdated":false,"valid":true,"latitude":53.134079444444446,"longitude":18.12027666666667,"altitude":0.0,"speed":23.758108,"course":359.0,"address":null,"accuracy":0.0,"network":{"radioType":"gsm","considerIp":false,"cellTowers":[{"cellId":22991,"locationAreaCode":54503,"mobileCountryCode":260,"mobileNetworkCode":3}]}}]} {"positions":[{"id":55595568,"attributes":{"sat":1,"ignition":false,"event":0,"archive":false,"distance":201.29,"totalDistance":6161762.74,"motion":true},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-29T13:22:42.975+00:00","deviceTime":"2025-05-29T13:22:40.000+00:00","fixTime":"2025-05-29T13:22:40.000+00:00","outdated":false,"valid":true,"latitude":53.135153333333335,"longitude":18.122701666666668,"altitude":0.0,"speed":37.79699,"course":66.0,"address":null,"accuracy":0.0,"network":{"radioType":"gsm","considerIp":false,"cellTowers":[{"cellId":22991,"locationAreaCode":54503,"mobileCountryCode":260,"mobileNetworkCode":3}]}}]} {"positions":[{"id":55595574,"attributes":{"sat":1,"ignition":false,"event":0,"archive":false,"distance":258.48,"totalDistance":6162021.22,"motion":true},"deviceId":35,"protocol":"gt06","serverTime":"2025-05-29T13:22:59.575+00:00","deviceTime":"2025-05-29T13:22:55.000+00:00","fixTime":"2025-05-29T13:22:55.000+00:00","outdated":false,"valid":true,"latitude":53.13609444444444,"longitude":18.12624,"altitude":0.0,"speed":31.317506,"course":65.0,"address":null,"accuracy":0.0,"network":{"radioType":"gsm","considerIp":false,"cellTowers":[{"cellId":22991,"locationAreaCode":54503,"mobileCountryCode":260,"mobileNetworkCode":3}]}}]}

And here form data from Traccar GUI:
tracca-speed.png

Speeds are mot the same as it is in GUI. I have tested it in my car and in GUI it looks similar to speedmeter in car but in JSON it is about 2 times less.

Have you tried search for an answer first?