Huabao JT808: WiFi data sent with ID 0xEC instead of 0xF4 → no geolocation

Nils Leideck 3 days ago

Hi everyone,

I'm trying to get network-based geolocation working for a Huabao JT808 device using UnwiredLabs. Here's my config:

GEOLOCATION_ENABLE=true
GEOLOCATION_TYPE=unwired
GEOLOCATION_URL=https://eu1.unwiredlabs.com/v2/process
GEOLOCATION_KEY=pk.xxx
GEOLOCATION_PROCESS_INVALID=true

The device sends location reports (0x0200) like this example:

7e02000072045460002319028500000000000000000000000000000000000000000000260411182238010400000058300112310100e4020064e50100e60100e7080000000600000000e10c010600030091c400ce542100ec23b286255f68fec4b286258f68fec458d9d5a16d79bae0d362e7acaeb9e0d362b519ceaff50101cd7e

What the device sends:

  • GPS: no fix (0°/0°)
  • 5 WiFi access points (MAC + signal)
  • 1 cell tower
  • Device is in sleep mode, stationary

The problem:
The WiFi data is never sent to UnwiredLabs. The forwarded positions still have lat=0, lon=0.

Root cause:
My device uses additional info ID 0xEC for WiFi data, but HuabaoProtocolDecoder only handles 0xF4 (line 797-802):

case 0xF4:  // WiFi access points
    while (buf.readerIndex() < endIndex) {
        String mac = ByteBufUtil.hexDump(buf.readSlice(6)).replaceAll("(..)", "$1:");
        network.addWifiAccessPoint(WifiAccessPoint.from(
            mac.substring(0, mac.length() - 1), buf.readByte()));
    }
    break;

Frame evidence: ...EC23b286255f68fec4...EC = ID, 23 = 35 bytes

Workaround: Adding case 0xEC: before 0xF4: makes it work.

Request: Could 0xEC be officially added to the decoder as a valid WiFi ID? Is this a known variant for Huabao devices?

Thanks!

Anton – any chance to get this into the main branch?

Anton Tananaev 3 days ago

Sure. Feel free to send a pull request.

Nils Leideck 3 days ago

Great, just done:

https://github.com/traccar/traccar/pull/5845

-- Cheers, Nils