Watch protocol features - How to use

Sensei3 years ago

Hello,

Thanks to this forum and github, I've successfully paired a GPS watch with Traccar, and I'd like to thank everyone for it.
Now I'm trying to understand how to use some of the embedded functionnality of Traccar. What's bugging me at the moment is the Voice message stuff. I'm able to receive messages out of the box, and that's pretty nice. But I have a few questions:

  1. Is there a way to be informed (events ?) of a message received (goal is to send an alert through home automation software) ? If not, I guess I'll try to monitor the "media" folder for new files, which is an acceptable workaround
  2. I couldn't get how to encode data to be sent with the "Voice Message" command (be it from the web interface or the API). I am no experienced coder, and I saw a few code snippets linked to in this forum but couldn't make much sense of it. Is there anyone that could give me pointers (and help me make sense of them) to be able to successfully use that command ? I can promise I'll document this once I get it working, because I've seen a few people asking the same kind of questions in several places.

Thank you for your time and your help !

Anton Tananaev3 years ago
  1. Check forwarding option.
Sensei3 years ago

Thank you ! I wasn't sure with the documentation alone, but reading other threads in the forum I managed to indeed forward events to Node-Red, and the rest should follow easily.
Since you didn't answer that part, I'm guessing you haven't had the opportunity to experiment with the voice message command. Do you know of anyone that might have that I could try to contact ?
Thanks again.

Anton Tananaev3 years ago

I think voice command should be encoded in HEX format, but I don't remember the details.

Sensei3 years ago

Well, I might have spoken a bit too soon :-( I indeed receive events through the API endpoint, but not for voice messages. I couldn't find a specific option and the documentation page for events only mentions text messages... do you have any idea why these specific events might not be forwarded like the others ?
Thanks !

Anton Tananaev3 years ago

You are looking for positions, not events.

Sensei3 years ago

I think voice command should be encoded in HEX format, but I don't remember the details.

yes, I believe this is right, but indeed that's what I was wondering. And how to pass that data to the web or API interfaces. I'll try again to make sense of the code snippets I've gathered here and there.

Sensei3 years ago
You are looking for positions, not events.

Ha, I had missed that indeed, thank you. Since the docs speak of "URL parameters", I guessed this should be a GET endpoint. Is that right ?
At the moment, when traccar receives a voice message, it does indeed call the forward.url URL, but it's not passing any query string or anything like that, and it ends up printing these logs:

2021-06-23 17:56:29  WARN: Event forwarding failed - Unexpected end of file from server - SocketException (...)
2021-06-23 17:56:29  WARN: Position forwarding failed: 2 pending - Unexpected end of file from server - SocketException (...)
2021-06-23 17:56:31  WARN: Position forwarding failed: 1 pending - Unexpected end of file from server - SocketException (...)
2021-06-23 17:56:31  WARN: Event forwarding failed - Unexpected end of file from server - SocketException (...)

Did I miss something on the traccar side or could it be a kind of incompatibility between traccar and Node-Red's HTTP GET endpoint ?

Once again, thanks for your time and help !

Anton Tananaev3 years ago

Seems like there's some issue with your endpoint.

Sensei3 years ago

Seems like there's some issue with your endpoint.

Well, since that indeed seemed the most probable cause, I tried forwarding events and position to a barebones docker http echo server (jmalloc/echo-server) and this is what I get when sending a Voice Message with the watch:

--------  172.17.0.1:60218 | GET /traccar-pos
Headers
"User-Agent" : ["Jersey/2.34 (HttpUrlConnection 11.0.9)"]
"Accept" : ["text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"]
"Connection" : ["keep-alive"]

So there's obviously something I didn't understand with the way Traccar forwards position info. Is it not supposed to be with query parameters (ie ?lat=00.0000 or something) ?

Sensei3 years ago

Just to be sure, I tried as well with pipedream, and this is what I got:

{
    "headers": {
        "host": "xxx.m.pipedream.net",
        "x-amzn-trace-id": "Root=1-xxx-xxx",
        "user-agent": "Jersey/2.34 (HttpUrlConnection 11.0.9)",
        "accept": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
    },
    "body": {},
    "inferred_body_type": "FORM",
    "method": "GET",
    "url": "https://xxx.m.pipedream.net/traccar-pos",
    "client_ip": "90.xx.xx.xx",
    "query": {}
}

So indeed, I believe the problem is not with the endpoint but with the way I configured Traccar. Here's what I have at the moment with regards to forwarding:

    <entry key='forward.enable'>true</entry>
    <entry key='forward.url'>https://xxx.m.pipedream.net/traccar-pos</entry>
Anton Tananaev3 years ago

What are you expecting to get with this config? You either have to provide query parameters template or you have to enable JSON.

Sensei3 years ago

Thank you ! Indeed I had missed the JSON part. Once enabled, and the endpoint switched to POST method, I've been able to receive position events and filter them on the "audio" attribute.

Thanks again for your help !