You should be able to send any command.
Hi Anton,
Do you have to create the saved command before being able to send it ? Or can you send any command dynamically ?
You don't have to create saved commands.
Hi Anton,
I have everything setup and the POST to the api is working fine. I would like to know how the data message needs to be structured in the attributes for the command if the command needed to be sent for example is as such :
@@c29,353358017784062,C49,3,2*4B\r\n
Check the official web app. It uses the same API.
Hi Anton,
I know you answer alot of questions and sometimes most of them are stupid so forgive me if these are.
Q1: I am using the official web app. Where do I look.
Q2: I'm assuming commands on the web app are available according to device type.
Q3: When setting up Saved Commands, these commands do not show up when I select the device and then select Command to send. Most likely because they are not supported by the device.
Q4: I tested the SendSMS command for the meitrack on the Traccar web app. This is what I see in the log returned. Not sure what the HEX returned means, if it was successful or not as the sms was not received on the phone number I sent it to.
2022-03-16 08:59:29 INFO: [9e2e1567] id: 867688034467492, command type: sendSms sent
2022-03-16 08:59:29 INFO: [9e2e1567: meitrack > 10.0.0.2] HEX: 40406635312c3836373638383033343436373439322c4330322c302c303736353838333836382c475053205465737420536d732a36310d0a
2022-03-16 08:59:34 INFO: [9e2e1567: meitrack < 10.0.0.2] HEX: 24246632382c3836373638383033343436373439322c4330322c4f4b2a32370d0a
For not supported commands you should use custom command option. I would recommend Chrome Network tool to see requests from the official app
Hi Anton,
After some more self learning. The sms command send via official web app.
HEX: 40406635312c3836373638383033343436373439322c4330322c302c303736353838333836382c475053205465737420536d732a36310d0a
ASCII : @@f61,867688034467492,C02,0,0795167132,THIS IS A TEST MESSAGE*2D
Result: 24246632382c3836373638383033343436373439322c4330322c4f4b2a32370d0a
ASCII Result: $$f28,867688034467492,C02,OK*27
So I just thought I would then ask if this is the way it should be sent via code: Hex or Ascii ?
{
"id": 0,
"deviceId": 9,
"description": "custom",
"type": "custom",
"attributes": {"data":"@@f51,867688034467492,C02,0,0765883868,GPS Test Sms*61" }
}
2022-03-17 10:05:16 INFO: [53e48314: meitrack > 10.0.0.2] HEX: 40406635312c3836373638383033343436373439322c4330322c302c303736353838333836382c475053205465737420536d732a3631
Looks right. You don't need to include id
and description
, but those things won't hurt, so it should work.
Hi Anton,
So I did some tests.
When sending the traccar sendSMS command from the web i get the following.
sendSMS Command:
HEX: 40406634332c3836373638383033343436373439322c4330322c302c303736353838333836382c746573742a32350d0a
ASCII: @@f43,867688034467492,C02,0,0765883868,test*25
Result (ASCII): $$f28,867688034467492,C02,OK*27
Command Sent from app using Custom Command Option:
HEX: 40406634332c3836373638383033343436373439322c4330322c302c303736353838333836382c746573742a3235
ASCII: @@f43,867688034467492,C02,0,0765883868,test*25
Result: No Result
Log File
2022-03-18 10:29:14 INFO: [43859cbb: meitrack > 10.0.0.2] HEX: 40406634332c3836373638383033343436373439322c4330322c302c303736353838333836382c746573742a32350d0a
2022-03-18 10:29:20 INFO: [43859cbb: meitrack < 10.0.0.2] HEX: 2424683136362c3836373638383033343436373439322c4141412c33352c2d32352e3834303430332c32382e3231373630352c3231303632303233303635322c562c302c392c302c302c302e302c302c33343134372c3633323939382c3635357c31307c353843397c30414139323839452c303030302c303030307c303030307c303030307c303138447c303030302c30303030303230312c2c332c303030302c2c33382c32332a35380d0a
2022-03-18 10:29:20 INFO: [43859cbb] id: 867688034467492, time: 2021-06-21 01:06:52, lat: -25.84040, lon: 28.21761, course: 0.0
2022-03-18 10:29:23 INFO: [43859cbb: meitrack < 10.0.0.2] HEX: 24246632382c3836373638383033343436373439322c4330322c4f4b2a32370d0a
2022-03-18 10:30:53 INFO: [43859cbb: meitrack > 10.0.0.2] HEX: 40406634332c3836373638383033343436373439322c4330322c302c303736353838333836382c746573742a3235
2022-03-18 10:30:55 INFO: [43859cbb: meitrack < 10.0.0.2] HEX: 24245a3136362c3836373638383033343436373439322c4141412c33352c2d32352e3834303430332c32382e3231373630352c3231303632303233313035312c562c302c392c302c302c302e302c302c33343134372c3633333233372c3635357c31307c353843397c30414139323839452c303030302c303030307c303030307c303030307c303138427c303030302c30303030303230312c2c332c303030302c2c33392c32342a33370d0a
2022-03-18 10:30:55 INFO: [43859cbb] id: 867688034467492, time: 2021-06-21 01:10:51, lat: -25.84040, lon: 28.21761, course: 0.0
2022-03-18 10:30:58 INFO: [43859cbb: meitrack < 10.0.0.2] HEX: 24245b3136362c3836373638383033343436373439322c4141412c33352c2d32352e3834303430332c32382e3231373630352c3231303632323134323131382c562c302c372c302c302c302e302c302c33343134372c3635363534392c3635357c31307c353843397c30414139323839452c303030302c303030307c303030307c303030307c303139457c303937322c30303030303230312c2c332c303030302c2c32392c34322a35440d0a
2022-03-18 10:30:58 INFO: [43859cbb] id: 867688034467492, time: 2021-06-22 16:21:18, lat: -25.84040, lon: 28.21761, course: 0.0
2022-03-18 10:31:01 INFO: [43859cbb: meitrack < 10.0.0.2] HEX: 24245c3136362c3836373638383033343436373439322c4141412c33352c2d32352e3834303430332c32382e3231373630352c3231303632303233313130312c562c302c392c302c302c302e302c302c33343134372c3633333234372c3635357c31307c353843397c30414139323839452c303030302c303030307c303030307c303030307c303138437c303030302c30303030303230312c2c332c303030302c2c33302c32382a33320d0a
2022-03-18 10:31:01 INFO: [43859cbb] id: 867688034467492, time: 2021-06-21 01:11:01, lat: -25.84040, lon: 28.21761, course: 0.0
So converting the HEX to ASCII of both commands seem to give the same result but one command does come back with the result and the other does not. The only difference i can see is that the command at the end is a little different.
Difference: sendSMS a32350d0a and CustomCommand a3235
You're missing CR LF characters. You might need to use API or directly edit a saved command in the database to add those characters because I don't need you can add them in the web app, unfortunately.
Hi Anton,
So sending the command from my application using the Traccar API includes the CRLF characters.
The following commands are available on the Traccar web app for the T622G device:
Engine Stop
Send SMS
Request Photo
Single Reporting
Arm Alarm
Disarm Alarm
Engine Resume
So what i did was test it from the web app, get the ASCII and then use my app and postman to send the same command to the API, the commands do produce a result from my app and postman.
Any other custom command sent according to the meitrack GPRS protocol document has no response when sending the command from my app or Postman. The command is sent correctly as the log shows the correct HEX with the CRLF characters.
I'm not sure what else to do now as I know my app is sending the commands correctly as tested above.
This is the log for sending the following command: @@X29,867688034467492,A13,120*37\r\n
This command sets the cornering report. There is no response.
Log:
2022-03-24 11:22:34 INFO: [d95e26a9: meitrack > 10.0.0.2] HEX: 40405832392c3836373638383033343436373439322c4131332c3132302a33370d0a
2022-03-24 11:22:35 INFO: [d95e26a9: meitrack < 10.0.0.2] HEX: 2424423136362c3836373638383033343436373439322c4141412c33352c2d32352e3834303430332c32382e3231373630352c3231303632313031323832392c562c302c392c302c302c302e302c302c33343134372c3634313439352c3635357c31307c353843397c30414139323839452c303030302c303030307c303030307c303030307c303136427c303030302c30303030303230312c2c332c303030302c2c32382c32372a32450d0a
2022-03-24 11:22:35 INFO: [d95e26a9] id: 867688034467492, time: 2021-06-21 03:28:29, lat: -25.84040, lon: 28.21761, course: 0.0
2022-03-24 11:22:38 INFO: [d95e26a9: meitrack < 10.0.0.2] HEX: 2424433136362c3836373638383033343436373439322c4141412c33352c2d32352e3834303430332c32382e3231373630352c3231303632383135313332382c562c302c382c302c302c302e302c302c33343134372c3730343733302c3635357c31307c353843397c30414139323839452c303030302c303030307c303030307c303030307c303139467c303937332c30303030303230312c2c332c303030302c2c35332c33362a34330d0a
2022-03-24 11:22:38 INFO: [d95e26a9] id: 867688034467492, time: 2021-06-28 17:13:28, lat: -25.84040, lon: 28.21761, course: 0.0
There is no response.
Isn't it a device issue or limitation?
Hi Anton,
I don't think there is a limitation or issue as I'm following the instruction from the OEM for the device.
Your protocol for Meitrack GPS can use any custom command ? Or just handle the ones that are available as per my previous message ? Why I am asking is because your command works. The only command I actually want to use is the following command:
Sending the Destination to the Garmin
GPRS Sending: D74,X1,X2,X3,X4,X5,X6
GPRS Reply D74,OK/<Error code>
Description:
X1: indicates the time when a message generates; 32-bit unsigned integer; hexadecimal
X2: indicates the message ID, which is unique; hexadecimal; contains up to 8 characters. If the message ID already exists, the command fails to be sent.
X3: indicates the latitude; 32-bit signed; hexadecimal; accurate to 6 decimal places.
X4: indicates the longitude; 32-bit signed; hexadecimal; accurate to 6 decimal places.
X5: indicates the destination; Unicode hexadecimal character string; contains up to 398 characters (199 bytes).
X6: indicates the serial port number of the Garmin navigator. X6 = 1: serial port 1; X6 = 2: serial port 2.
GPRS Command
@@O73,866699027509340,D74,302480F5,00000000,015787A6,06CC5FBB,F5456B00,02*11\r\n
GPS Response
$$O73,866699027509340,D77,FFFFFFFF,00000000,FFFFFFFF,F5456B00,F5456B00,02*11\r\n
Hi,
Can a post be made to send a Co-Ordinates command to a GPS unit using the manufacturers GPRS Protocol ?
GPS in question is a Meitrack T622.
I do have the GPRS protocol from Meitrack.