Commands issue v4.13

Claudio Carrasco3 years ago

Hi!

I installed the latest versiĆ³n of traaccar and I get the next error when I send commands to an H02 device (not always, about the 60% of the times):

Odd number of characters. - DecoderException (... < DataConverter:29 < BaseProtocol:96 < ActiveDevice:55 < ...)

The command is "RESTART" (to test the feature), and the devices are online with 0 minutes since the last update.
Does anyone know the reason or the solution?

Regards!

Anton Tananaev3 years ago

Seems like it's expecting binary data in HEX format and you are sending text.

Claudio Carrasco3 years ago

Hi Anton

The problem persists if I send numeric commands (e.g. 9400000 or 9410000).

Anton Tananaev3 years ago

Same reason.

Claudio Carrasco3 years ago

and if that's the case, why does it sometimes run the command?

Anton Tananaev3 years ago

Not sure. You need to check logs. Maybe it connects on a wrong port?

Claudio Carrasco3 years ago

Ok, I have more info about the problem:

I checked the logs and I see that the device stops the connection periodically:

2021-07-13 02:09:00  INFO: [e6ed9b5d: h02 > 181.43.227.9] HEX: 2a48512c393137313030383738382c56342c56312c323032313037313330323039303023
2021-07-13 02:09:00  INFO: [e6ed9b5d] id: XXXXXXXXXX, time: 2021-07-13 02:08:58, lat: -36.78876, lon: -73.03241, course: 102.0
2021-07-13 02:09:00  WARN: [e6ed9b5d] error - Connection reset by peer - IOException (...)
2021-07-13 02:09:00  INFO: [e6ed9b5d] disconnected
2021-07-13 02:09:01  INFO: [42ced440] connected
2021-07-13 02:09:20  INFO: [42ced440: h02 < 181.43.227.9] HEX: 2a48512c393137313030383738382c56312c3032303931382c412c333634372e333235322c532c30373330312e393434372c572c3030302e30302c3130322c3133303732312c46464646424246462c3733302c30312c35383030312c333535383423

The result is a device's flicker between the online / offline status on the server. To avoid this behavior, I configured the "ignore offline status" in the traccar.xml file:

    <entry key='status.ignoreOffline'>h02</entry>

Now, the device always appears online, but in reality it's not. So when I send the command when the device stops the connection to the server, I get the error.

There is a way to solve this?

Thanks Anton.

Anton Tananaev3 years ago

I don't see the command in your log.

Claudio Carrasco3 years ago

Here is a log with some failed attempts to send RESTART command and the last successful one (mark with -->>):

2021-07-13 04:07:42  INFO: [2cc779e4] connected
2021-07-13 04:07:42  INFO: [2cc779e4: h02 < 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56312c3034303635352c412c333634372e333235322c532c30373330312e393434392c572c3030302e30302c3030302c3133303732312c46424646424246462c3733302c30312c35383030312c333535383423
2021-07-13 04:07:42  INFO: [2cc779e4: h02 > 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56342c56312c323032313037313330343037343223
2021-07-13 04:07:42  INFO: [2cc779e4] id: XXXXXXXXXX, time: 2021-07-13 04:06:55, lat: -36.78875, lon: -73.03242, course: 0.0
2021-07-13 04:07:43  INFO: [2cc779e4: h02 < 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56312c3034303731342c412c333634372e333235302c532c30373330312e393434352c572c3030302e30302c3030302c3133303732312c46424646424246462c3733302c30312c35383030312c333535383423
2021-07-13 04:07:43  INFO: [2cc779e4: h02 > 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56342c56312c323032313037313330343037343323
2021-07-13 04:07:43  INFO: [2cc779e4] id: XXXXXXXXXX, time: 2021-07-13 04:07:14, lat: -36.78875, lon: -73.03241, course: 0.0
2021-07-13 04:07:43  WARN: [2cc779e4] error - Connection reset by peer - IOException (...)
2021-07-13 04:07:43  INFO: [2cc779e4] disconnected
2021-07-13 04:07:44  INFO: [8e5838dc] connected
2021-07-13 04:07:45  INFO: [8e5838dc: h02 < 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56312c3034303733342c412c333634372e333234392c532c30373330312e393434312c572c3030302e30302c3030302c3133303732312c46424646424246462c3733302c30312c35383030312c333535383423
2021-07-13 04:07:45  INFO: [8e5838dc: h02 > 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56342c56312c323032313037313330343037343523
2021-07-13 04:07:45  INFO: [8e5838dc] id: XXXXXXXXXX, time: 2021-07-13 04:07:34, lat: -36.78875, lon: -73.03240, course: 0.0
2021-07-13 04:07:56  INFO: [8e5838dc: h02 < 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56312c3034303735342c412c333634372e333234382c532c30373330312e393433392c572c3030302e30302c3030302c3133303732312c46464646424246462c3733302c30312c35383030312c333535383423
2021-07-13 04:07:56  INFO: [8e5838dc: h02 > 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56342c56312c323032313037313330343037353623
2021-07-13 04:07:56  INFO: [8e5838dc] id: XXXXXXXXXX, time: 2021-07-13 04:07:54, lat: -36.78875, lon: -73.03240, course: 0.0
2021-07-13 04:07:56  WARN: [8e5838dc] error - Connection reset by peer - IOException (...)
2021-07-13 04:07:56  INFO: [8e5838dc] disconnected
2021-07-13 04:07:58  INFO: [d12f5fbf] connected
2021-07-13 04:08:16  INFO: [d12f5fbf: h02 < 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56312c3034303831342c412c333634372e333234382c532c30373330312e393433382c572c3030302e30302c3030302c3133303732312c46464646424246462c3733302c30312c35383030312c333535383423
2021-07-13 04:08:16  INFO: [d12f5fbf: h02 > 186.11.80.XXX] HEX: 2a48512c393137313030383738382c56342c56312c323032313037313330343038313623
2021-07-13 04:08:16  INFO: [d12f5fbf] id: XXXXXXXXXX, time: 2021-07-13 04:08:14, lat: -36.78875, lon: -73.03240, course: 0.0
--->>2021-07-13 04:08:17  INFO: [d12f5fbf: h02 > 186.11.80.XXX] HEX: 52455354415254<<---
2021-07-13 04:08:17  WARN: [d12f5fbf] error - Connection reset by peer - IOException (...)
2021-07-13 04:08:17  INFO: [d12f5fbf] disconnected
2021-07-13 04:08:19  INFO: [ce482650] connected
2021-07-13 04:08:29  INFO: [ce482650] disconnected
Anton Tananaev3 years ago

Doesn't look like a valid command. Where did you get it from?

Claudio Carrasco3 years ago

From the manufacturer. In fact the command, when run, works.

additionally I investigated about the communication channels of the commands and it says that

1. The transmission mode
The Terminal (GPS tracker) and the server has 3 communication channels:
1) TCP protocol command channel: command and the corresponding reply information uses
ASCII code to transmit via TCP, the format is the same as SMS.

https://drive.google.com/file/d/1C86e8zBMMDUgkZVMAF19CQ93rwmH9tSF/view

Anton Tananaev3 years ago

What about the following part?

Command Structure Description
1. From Server to Terminal (GPS tracker)
*XX,YYYYYYYYYY,CMD,HHMMSS,PARA1,PARA2,...#

I guarantee you that TCP commands have to have some structure. It can't be just free form text without any delimiters because there will be no way to know where one command ends and next begins. TCP is a streaming protocol.

Claudio Carrasco3 years ago

Yes, theoretically you are right, but in practice the command always works when the device does not stop communication with the server.
On a 100% online device, the command works all the time.