H02 Protocol Devices Appear Offline Even Though They Send Heartbeat (HTBT

MAXIMILIANO FLEX20 days ago

Problem Description
I am using Traccar 6.6 on my server with devices that use the H02 protocol. I have noticed that even though the devices correctly send the HTBT (heartbeat) message and the server responds, the devices still appear as "offline" in the web interface.

When analyzing the logs, I can see that Traccar receives and processes the HTBT without errors:

2025-03-12 00:50:59  INFO: [T5100a395: h02 < 191.156.229.211] *HQ,869731052574068,HTBT#
2025-03-12 00:50:59 DEBUG: Event received
2025-03-12 00:50:59 DEBUG: Message queued
2025-03-12 00:50:59 DEBUG: Event decoded 0
2025-03-12 00:50:59  INFO: [T5100a395: h02 > 191.156.229.211] *HQ,869731052574068,HTBT#

However, the devices only appear as "online" when they send a position message. For example:

2025-03-12 00:51:00  INFO: [T9a7057b3: h02 < 191.156.186.140] *HQ,869731053141230,V1,055059,A,0633.97032,N,07306.49887,W,020.52,005,120325,FFFFFFFF#
2025-03-12 00:51:01  INFO: [T9a7057b3] id: 869731053141230, time: 2025-03-12 00:50:59, lat: 6.56617, lon: -73.10831, speed: 20.5, course: 5.0

It seems that Traccar does not use HTBT messages to update lastUpdate and keep the device online.

What I have tried without success:

  • I checked the timeout configuration (status.timeout = 600), but this doesn’t work because lastUpdate is not updated with the HTBT.
  • I tried using calculated attributes, but lastUpdate is not an available option.

Is it possible to modify Traccar to update lastUpdate with HTBT messages for the H02 protocol?
Is there an alternative solution without modifying the source code?
If modification is needed, which part of the code (H02ProtocolDecoder.java or another file) should I modify?

I would appreciate any help or suggestions regarding this issue.

Anton Tananaev20 days ago

It's possible to modify.

MAXIMILIANO FLEX20 days ago

Thank you for your response! Since it is possible to modify this behavior, could you please guide me on:

Which file(s) should be modified? I assume it would be in H02ProtocolDecoder.java, but I want to confirm.
What specific change should be made to update lastUpdate when receiving an HTBT message?
Would this require additional modifications elsewhere in the Traccar codebase (e.g., device status handling)?
I appreciate your help!

Anton Tananaev20 days ago

Changing H02ProtocolDecoder.java should be enough. You need to decode IMEI from the heartbeat and get device session using that id.