ST-901L-4G, protocol, and update intervals

trsdm5 months ago

I am not using Traccar, but I still hope I can post this here so any experienced people might give their answers!

I am building a little system by writing a small TCP server in PHP by myself. I have the ST-901L-4G and I can't really understand the data it transmits. If I start a fresh server the first message is data in a format I would expect, i.e.

*HQ,[REDACTED],V5,183100,A,[REDACTED],N,[REDACTED],E,0.00,0,100624,FFFFFDFF,242,1,81a4,2000,0#

But if I keep the socket open it sends some binary data every 1-2 seconds. When converted to HEX it looks a lot like the data sent in the first message, just not quite.

It keeps sending that data every two seconds and only sometimes sends the "correctly" formatted string again. If I close the socket each time it has sent data, it does something else. Then it sends the correct data, disconnects, sends the binary data, disconnects, sends the correct data, disconnects etc. every 10 seconds. So I get the correct data every 20 seconds.

It does both of these things regardless of the intervals I have set on ACC on and ACC off.

I am really struggling with this. I don't want to share the HEX until I have found a way to obfuscate my position in it, but perhaps someone has worked with this tracker before.

Someone else I sent this to said it could look like the Huabao protocol, but the first does not? I don't see why it should send two different kinds of data and not honor the intervals I set. It does honor the sleep timeout it would seem.

I read in a Huabao-manual for a different tracker that it will retry the message if it does not get a defined answer back to acknowledge that it was received, but I can't see anywhere what that would be?

I was expecting the *DATA# message every N seconds where N=the interval I have configured the device to use. Instead I get binary every 1-2 seconds.

Any help is appreciated!

Anton Tananaev5 months ago

This protocol includes both text-based messages and binary. Both are valid messages. You should check the protocol documentation.

trsdm5 months ago

I would love to!

Do you know where I can find it? I have scrolled through the page on this site with all the protocols and can't seem to understand what I am looking for?

I have also written to SinoTrack support, but they will not help.

Any idea why it does not respect my update intervals? Why answer SET OK and then just ignore what I just set?

Anton Tananaev5 months ago

I believe we have the documentation for it on the website.

trsdm5 months ago

I have now tried my search again and see that it sends one message in the H02 protocol, and then it just sends binary. It does not send Huabao as defined here: https://www.traccar.org/identify-protocol/ Did you mean you have documentation about why it does not respect the update intervals and never sends a message with the H02-protocol after the first one, only binary every 2 seconds? I have not been able to find it.

I have tried to decode the data now. I have changed the serial number and location. It looks like this. There is 1 second between these messages (I have added spaces):

*HQ,9232000030,V5,044826,A,7730.5000,N,1644.5250,E,0.00,0,130624,FFFFFDFF,242,1,81a4,2000,0#
24 9232000030 044815 130624 77305000 00 16445250 e000000 fffffdff 00005b230000000000f201 81a4 2000 56
24 9232000030 044828 130624 77305000 00 16445250 e000000 fffffdff 00005b230000000000f201 81a4 2000 57
24 9232000030 033853 130624 77305000 00 16445250 e000000 fbfffdff 00005aa80000000000f201 81a4 2000 58

As far as I can tell on the binary data:

24 | SERIAL_NUMBER | WRONG_TIME | DATE | LOCATION_NORTH | LOCATION_EAST | NOT_SURE | STATE | NOT_SURE | 81a4 (meaning?) | 2000 (meaning?) | INCREMENTING_NUMBER (that also contains letters sometimes)

But I see from some of the H02 documents that I may be misinterpreting the data. I will try to interpret it better using the documents. But still a few questions:

  1. Should I expect *DATA# every interval seconds?
  2. Is it possible to disable the sending of binary data, or at least make it so that it does not happen that often, to save data?

I see in one of the documents for commands:

upload interval *HQ,7301000001,S71,031738,22,20#

But there is no explanation. Will this change the binary sending interval if I end it by SMS?

Anton Tananaev5 months ago

I don't know about disabling binary data, but you should read the protocol documentation, as I mentioned:

https://www.traccar.org/protocols/

MK3 months ago

Hi,

I have the same problem as @trsdm. Part of my log looks like this [I tried to do some anonymization, so sorry if the data is a bit incorrect]:

2024-08-17 23:50:09  INFO: [T0b6cae61: h02 < 1.2.3.4] 2a48512c313233343536373839302c56352c3231353030392c412c363632372e383739302c4e2c323934382e313734312c452c302e30302c302c313730383234
2024-08-17 23:50:09  INFO: [T0b6cae61: h02 < 1.2.3.4] 2c46464646464446462c3238302c342c636664312c3531322c3023
2024-08-17 23:50:09  INFO: [T0b6cae61] id: 1234567890, time: 2024-08-17 23:50:09, lat: 66.45798, lon: 29.80790, course: 0.0
2024-08-17 23:50:11  INFO: [T0b6cae61: h02 < 1.2.3.4] 2412345678900321101608246627462400029484850c000000fbfffdff00000aa200000000010403cfd10512b4
2024-08-17 23:50:11  INFO: [T0b6cae61] id: 1234567890, time: 2024-08-16 05:21:10, lat: 66.45771, lon: 29.80808, course: 0.0
2024-08-17 23:50:13  INFO: [T0b6cae61: h02 < 1.2.3.4] 2412345678900321101608246627462400029484850c000000fbfffdff00000aa200000000010403cfd10512b5
2024-08-17 23:50:13  INFO: [T0b6cae61] id: 1234567890, time: 2024-08-16 05:21:10, lat: 66.45771, lon: 29.80808, course: 0.0
...
...
...
2024-08-17 23:53:10  INFO: [T0b6cae61: h02 < 1.2.3.4] 2412345678900321101608246627462400029484850c000000fbfffdff00000aa200000000010403cfd105120f
2024-08-17 23:53:10  INFO: [T0b6cae61] id: 1234567890, time: 2024-08-16 05:21:10, lat: 66.45771, lon: 29.80808, course: 0.0
2024-08-17 23:53:11  INFO: [T0b6cae61: h02 < 1.2.3.4] 2a48512c313233343536373839302c56352c3231353030392c412c363632372e383739302c4e2c323934382e313734312c452c302e30302c302c313730383234
2024-08-17 23:53:11  INFO: [T0b6cae61: h02 < 1.2.3.4] 2c46464646464446462c3238302c342c636664312c3531322c3023
2024-08-17 23:53:11  INFO: [T0b6cae61] id: 1234567890, time: 2024-08-17 23:53:11, lat: 66.45798, lon: 29.80790, course: 0.0

My device is set to send position every 180 seconds. So the first and the last line are the required data.
The problem is the lines between the extremes. Send every few seconds.
They are properly decoded by Traccar (maybe apart from time), but they are completely unnecessary.

So I have 2 questions:

  1. Is it possible to set ST-901L-4G to completely stop sending these binary messages?
  2. Is it possible to set Traccar to ignore these binary messages? Ignore means: do not add to logs and to database.

Regards,
Marcin

trsdm3 months ago

I wish I could help, but my solution was actually to buy a LilyGO T-SIM7600E and put my own code on it to send the data. I am not trying to get it into Traccar, but into Home Assistant. So the first thing I did was to make this integration to Home Assistant:

https://community.home-assistant.io/t/trsdm-dynamic-device-tracker-flexible-tracking-with-custom-attributes/754974

Then I configured the device to send data to that. I am not using SSL because I can't get it to work with the SIM7600 - I have to wait until a library makes it happen...

But the Sinotrack doesn't use SSL either, so that's a moot point.

It works now, and there is no hardcoded Chinese IP-address receiving my data either, which is a plus!

Anton Tananaev3 months ago

Is it possible to set Traccar to ignore these binary messages? Ignore means: do not add to logs and to database.

No. You would need to change the code for that.

MK3 months ago

Logs - I've changed log level from info to warning:

<entry key='logger.level'>warning</entry>

Sources - I've changed the line https://github.com/traccar/traccar/blob/master/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java#L629 to:

                return null;

I think it would be better to make something like:

if (getConfig().getBoolean(Keys......)) {
                return decodeBinary(buf, channel, remoteAddress);
} else {
                return null;
}

But for now I don't understand how the config file is processed and how to add new option :(

MK3 months ago

Done...

Added to src/main/java/org/traccar/config/Keys.java:

    /**
     * Enable binary messages decoding for the protocol.
     */
    public static final ConfigSuffix<Boolean> PROTOCOL_BINDEC = new BooleanConfigSuffix(
            ".binDecode",
            List.of(KeyType.CONFIG));

and modified src/main/java/org/traccar/protocol/H02ProtocolDecoder.java:

            case "$":
                if (getConfig().getBoolean(Keys.PROTOCOL_BINDEC.withPrefix(getProtocolName()))) {
                    return decodeBinary(buf, channel, remoteAddress);
                } else {
                    return null;
                }

then added to traccar.xml:

    <entry key='h02.binDecode'>false</entry>

with true works like before changes.

BTW: I made modifaction on 5.9 sources. Traccar upgrade is in my plans :)

ontox3 months ago

Hi there,

I have the same problem. My ST-901 is sending data every 2 seconds and eats up sim data.

The device does not respect sleep mode option and Traccar shows ACC on, even if it is off (orange wire connected but 0.0V).

Does anyone found a solution for this big problem?

Thanks
Dom

Steph2 months ago

I have the same problem as well. My ST-901L is working well for 20 min, my traccar server receives good info, and then, the st-901 sends data every 2 seconds

when I reset the device, redo all the config, all works fine again , getting data every 1 min as expected but again, ..after a moment, back to "binaries data" sent every 2 seconds
:-(