H02 protocol parsing issue

maxw3ll7 years ago

I am running Traccar 3.13 (although on start the log says 3.12-SNAPSHOT) and witness an issues for the second time now with the H02 protocol (LK710 tracker). I think I also saw it on 3.11.

017-07-20 06:08:06 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3036303830362c412c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 06:08:06  INFO: [87A253BB] id: 4710003845, time: 2035-07-01 13:31:30, lat: -38.57255, lon: -314.05061, speed: 383.0, course: 36.0

The HEX translates to:

*HQ,4710003845,V1,060806,A,4730.7653,N,01218.3174,E,000.00,000,200717,FFFFF9FF,232,03,0,0,6#

HEX data looks OK to me, but still the server completely messes up.
And although I enabled filters and set filter.future to 86400 (1 day), it used this result with a timestamp of 18 years in the future. Now any further (valid) updates from the device are neglected as the timestamp is older than year 2035. The only way I could resolve the issue was to remove the device and add it again.

This seems to be a rare case as other packets from the same tracker are handled correctly. I think most of the time the trailing "... ,232,03,0,0, ..." is not part of the packets. Maybe this causes the failure?

Anton Tananaev7 years ago

I would recommend to check following thread:

https://www.traccar.org/forums/topic/traccar-3-7-odd-position-issue/

The problem is most likely with decoding binary messages that come before the one that you provided.

maxw3ll7 years ago

Indeed the logs show multiple messages with "dubious" content before the invalid timestamp:

2017-07-20 05:05:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450347522007174730765306012183170c000000fffff9ffff001600000000f700e80300000000018e1c
2017-07-20 05:05:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 05:08:08 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:08:08  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:11:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:11:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:14:08 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450347522007174730765306012183170c000000fffff9ffff001600000000f700e8030000000001921d
2017-07-20 05:14:08  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 05:17:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:17:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:20:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:20:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:23:08 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450347522007174730765306012183170c000000fffff9ffff001600000000f700e8030000000001921e
2017-07-20 05:23:08  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 05:26:08 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:26:08  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:29:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:29:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:32:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450347522007174730765306012183170c000000fffff9ffff001600000000f700e8030000000001921f
2017-07-20 05:32:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 05:35:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:35:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:38:06 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:38:06  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:41:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450347522007174730765306012183170c000000fffff9ffff001700000000f700e80300000000019220
2017-07-20 05:41:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 05:44:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:44:08  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:47:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3033343735322c562c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:47:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:48:06 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 
2017-07-20 05:48:06  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 03:47:52, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:50:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450550062007174730765306012183170e000000fffff9ffff001724000000f700e80300000000018621
2017-07-20 05:50:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 05:50:06, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 05:53:06 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3035353330352c412c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:53:06  INFO: [87A253BB] id: 4710003845, time: 1999-12-06 04:03:00, lat: -2.43688, lon: -514.05729, speed: 303.0, course: 30.0

2017-07-20 05:56:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3035353630362c412c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:56:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 05:56:06, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 05:58:05 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450558052007174730765306012183170e000000fffff9ffff001635000000f700e80300000000018622
2017-07-20 05:58:05  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 05:58:05, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 05:59:06 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3035353930352c412c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 05:59:06  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 05:59:05, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 06:02:07 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3036303230362c412c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 06:02:07  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 06:02:06, lat: 47.51276, lon: 12.30529, speed: 0.0, course: 0.0

2017-07-20 06:05:06 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450605052007174730765306012183170e000000fffff9ffff001644000000f700e80300000000018723
2017-07-20 06:05:06  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 06:05:05, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 06:08:05 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2447100038450608052007174730765306012183170e000000fffff9ffff001654000000f700e80300000000018724
2017-07-20 06:08:05  INFO: [87A253BB] id: 4710003845, time: 2017-07-20 06:08:05, lat: 47.51276, lon: 12.30528, speed: 0.0, course: 0.0

2017-07-20 06:08:06 DEBUG: [87A253BB: 5013 < 46.125.249.18] HEX: 2a48512c343731303030333834352c56312c3036303830362c412c343733302e373635332c4e2c30313231382e333137342c452c3030302e30302c3030302c3230303731372c46464646463946462c3233322c30332c302c302c3623
2017-07-20 06:08:06  INFO: [87A253BB] id: 4710003845, time: 2035-07-01 13:31:30, lat: -38.57255, lon: -314.05061, speed: 383.0, course: 36.0

How does Traccar handle them? I can talk to the manufacturer (LKGPS) in case the protocol is different to what is known as H02 and ask for clarification.

Still it is not clear to me why Traccar uses the invalid timestamp as I have set the following filter rules to prevent it (as also noted in the thread you pointed out):

    <entry key='filter.enable'>true</entry>
    <entry key='filter.invalid'>true</entry>
    <entry key='filter.duplicate'>true</entry>
    <entry key='filter.future'>86400</entry>
Anton Tananaev7 years ago

I would recommend to read the thread that I linked. I explains the problem and the solution.

maxw3ll7 years ago

Yes, I have read it carefully twice and it suggests different things:

  • disable LBS -> didn't do that yet, but others claimed it didn't help them either - will try it now
  • wait for 3.8 release -> I am already on 3.13
  • use filter.future -> which I did but didn't help

Still I do not understand why this date is used with filter.future enabled. Even if the device sends garbage it shouldn't care.

Anton Tananaev7 years ago

Here is the relevant comment:

https://www.traccar.org/forums/topic/traccar-3-7-odd-position-issue/page/2/#post-8339

In your case it seems like the message length is 47.

maxw3ll7 years ago

Thanks, I thought that was only a workaround for pre 3.8 release. Will try again with this setting.

I also contacted LKGPS. You got an email with the protocol spec.