Can the traccar server publish all data received from a module via mqtt?

Turbovix5 months ago

Hello everyone, can anyone tell me if there is a way for the traccar server to report all data received from a device via mqtt? I integrated with my mqtt broker, but only events are reported.
I appreciate any information.

Turbovix5 months ago

I found the answer, however I'm going to make a feature request on github, who knows, it might appear in future versions.

https://www.traccar.org/forums/topic/mqtt-updates-are-not-frequent-as-http-url/

Anton Tananaev5 months ago

Why do you need a feature request? The answer is that you can forward both positions and events. The thread you found is outdated.

Turbovix5 months ago

Thanks for answering.
Great news, so should I have the following entries?

 <entry key='event.forward.type'>mqtt</entry>
 <entry key='event.forward.url'>mqtt://XXXXXXXX@XXXXXXXXX:1883</entry>
 <entry key='event.forward.topic'>traccar/events</entry>

 <entry key='positions.forward.type'>mqtt</entry>
 <entry key='positions.forward.url'>mqtt://XXXXXXXXXX@XXXXXXX:1883</entry>
 <entry key='positions.forward.topic'>traccar/positions</entry>
Anton Tananaev5 months ago

No, you need to check the official documentation:

https://www.traccar.org/configuration-file/

Turbovix5 months ago

I had visited the documentation before, but there is nothing there related to MQTT.

Anton Tananaev5 months ago

There's nothing about MQTT, but you will find position forwarding configuration keys there.

Turbovix5 months ago

I tried the configurations in different ways, but only events arrive at the broker, with these configurations:

 <entry key='event.forward.type'>mqtt</entry>
 <entry key='event.forward.url'>mqtt://XXXXXXXX@XXXXXXXXX:1883</entry>
 <entry key='event.forward.topic'>traccar/events</entry>

I tried:

 <entry key='forward.type'>mqtt</entry>
 <entry key='forward.url'>mqtt://XXXXXXXX@XXXXXXXXX:1883</entry>
 <entry key='forward.topic'>positions</entry>
 <entry key='forward.type'>url</entry>
 <entry key='forward.url'>mqtt://XXXXXXXX@XXXXXXXXX:1883</entry>
 <entry key='forward.topic'>positions</entry>

But without success.

Anton Tananaev5 months ago

The first version looks correct. Make sure you're using the latest version of Traccar.

Turbovix5 months ago

Do you mean this version?

 <entry key='forward.type'>mqtt</entry>
 <entry key='forward.url'>mqtt://XXXXXXXX@XXXXXXXXX:1883</entry>
 <entry key='forward.topic'>positions</entry>
Anton Tananaev5 months ago

Yes.

Turbovix5 months ago

I can't find what could be wrong.
nothing appears in the log.
And the broker only shows the name of the topic (positions)

Turbovix5 months ago

mqtt-1.png
mqtt-2.png

Turbovix5 months ago

Good morning Anto!
I found the problem, the problem is in this commit:
https://github.com/traccar/traccar/commit/b8ae04d5435fda76646da139fb0b74068c60caf7

As I had downloaded the sources on the day you released version 6.2, this fix was not yet available. So I made the change and rebuilt. Now it's working perfectly.
commit.png

mqtt-3.png