Custom Command response from API

Ólavur7 years ago

Hello,

Is is possible to get some vales back from the response from the API?

When I post:

{
  "deviceId": 1,
  "type": "custom",
  "attributes": {
             "data":   "2a545330312c4d475223"
            }
}

I get this response using the ulbotech protocol:

{
  "id": 0,
  "attributes": {
    "data": "2a545330312c4d475223"
  },
  "deviceId": 1,
  "type": "custom"
}

In the traccar logfile I can see the value in the response:

2017-03-10 12:37:58 DEBUG: [A3C18CD4: 5072 > 185.74.208.99] HEX: 2a545330312c4d475223
2017-03-10 12:37:59 DEBUG: [A3C18CD4: 5072 < 185.74.208.99] HEX: 2a545330312c3836383332333032353234353735312c3132333735393130303331372c4d47523a3235303336313723

Converting this to text:
Command:(*TS01,MGR#)
Response in logfile (*TS01,868323025245751,123759100317,MGR:2503617#)

But is it possible to get the response using the API?

Anton Tananaev7 years ago

Response from device should be coming in the "result" attribute of the position object, so you can get it through API, but it's not supported for all protocols. It's also not possible to get it as a part of command API response.

Ólavur7 years ago

Ok, thanks.

I am using the Ulbotech protocol but I cannot see any "result" attribute:

{"hdop":9999,"ignition":false,"status":0,"odometer":2524915,"adc0":965,"adc1":2268,"adc2":525,"geofenceIn":0,"geofenceAlarm":0,"event":240,"eventMask":512,"ip":"185.74.208.99","distance":0.0,"totalDistance":1899784.59} 

I can see in the traccar.log that the command was sent at this time.

Does the Ulbotech protocol not support the "result" attribute?

Anton Tananaev7 years ago

Traccar doesn't support result attribute for Ulbotech protocol at the moment.

Agam6 years ago

I am using minifinder protocol & sending the custom commands via GPRS but i am not getting any notifications on the web interface about the response. I can see the HEX response in the log file but its not showing to the interface. i have enabled all notifications

Anton Tananaev6 years ago

Do you see response in attributes? Can we see logs?

Agam6 years ago

Hi @Anton, I don't see any response in the attributes. The response i am getting is

{"id":2,"attributes":{"data":"123456A1,7055001772"},"deviceId":81,"type":"custom","textChannel":false,"description":"phone1"}

The log on the server is

2018-10-25 09:46:19 DEBUG: [41197921: 5062 > 199.47.48.41] HEX: 31323334353641312c37303535303031373732
2018-10-25 09:46:24 DEBUG: [41197921: 5062 < 199.47.48.41] HEX: 21332c6f6b3b
2018-10-25 09:47:02  INFO: [5C6FEDDA] connected

Any help would be really appreciated. Thanks

Anton Tananaev6 years ago

I'm asking about device response, not API response.

Agam6 years ago

The device is replying with !3,ok; which i took from Traccar Log & decoded it via https://www.traccar.org/hex-decoder/

Anton Tananaev6 years ago
Agam6 years ago

Thank you @Anton. I really appreciate your help.

Thomas Schifer5 years ago

As Agam I am using minifinder protocol & sending custom commands via GPRS. I don`t ask for the location, but for the SOS numbers. The device replies with !4, ... (the numbers). I could see that in Traccar Log. I also see the new implementation in the last Source, where Agams !3 is stored as last position. For type.equals("4") there is no implementation. However is there a way to get the reponse of the device as response in the web API?

Anton Tananaev5 years ago

Create a request for it on GitHub, provide samples and documentation.