Release 5.6 - MQTT support for event forwarding

Christoph2 years ago

here are the received message in nodered:

3.7.2023, 15:52:03node: MQTT EVIEW in
traccar/events : msg : Object
object
topic: "traccar/events"
payload: ""
qos: 0
retain: false

next problem: the payload are empty

Christoph2 years ago

Position data comes only in a alarm case.

topic: "traccar/events"
payload: object
event: object
position: object
device: object

the "normal" mesage has only this:

object
topic: "traccar/events"
payload: object
event: object
device: object

without position message

what is the exact configuration that the position is always output. this also includes these additional attributes:

position: object
id: 179
attributes: object
motion: true
rssi: 21
batteryLevel: 54
status: 917127680
alarm: "sos"
distance: 0
totalDistance: 0

it would be great if i could always receive all information via mqtt ;)

Anton Tananaev2 years ago

You should receive all the information. What do you mean by normal message? Which event type are you talking about? Because connection status events don't have associated position and that's expected because they are not linked to a position.

Christoph2 years ago

the device continuously sends the position data at regular intervals, depending on the configuration.
these are also shown on the map in the traccar web. but i don't get it over mqtt. the position data, batt level, etc. information only in case of an alarm (sos button)

Christoph2 years ago

by the way, where can i spend a beer?

Anton Tananaev2 years ago

Which specific event type doesn't have the position? You have to be specific.

If by beer you mean donation, there's a link at the bottom of the page.

Christoph2 years ago

this is the description from the message from the device:

GPS Location (0x20)
...
Christoph2 years ago

a message in JSON:

{
channel.id : 1143383
device.id : 5100441
device.name : "test"
device.type.id : 782
event.enum : 32
gnss.vehicle.mileage : 478021
ident : "86231**********"
peer : "194.230.144.35:63234"
position.altitude : 474
position.direction : 0
position.hdop : 6
position.latitude : 47.075453
position.longitude : 8.275569
position.satellites : 12
position.speed : 1
protocol.id : 254
server.timestamp : 1689252221.22185
timestamp : 1689252221.22185
}
Anton Tananaev2 years ago

I feel like you're confusing positions and events. I am talking about Traccar events. MQTT forwarding is only currently available for events.

Christoph2 years ago

OK. i think that's the problem. beer is on the way ;)
Is an extension of the MQTT functions in planning on the roadmap?

Anton Tananaev2 years ago

No specific plans, but if someone contributes the implementation or sponsors it, we're happy to include it.

Christoph2 years ago

What would that mean in terms of time and money? When I read the posts here in the forum, I have the feeling that many would appreciate receiving the real-time position directly via MQTT instead of taking the detour via the API

Anton Tananaev2 years ago

Email support to discuss that.

jokakillaa year ago

Sorry for warming this up. I tried to connect Node-Red with the aedes broker and Traccar and get errors regarding the MQTT version.

Looking at the code it looks like only MQTT version 5 is supported. Is that correct? My current broker supports only MQTT 3.x.
If this would be appreciated I could try to extend EventForwarderMqtt to it checks a new key EVENT_FORWARD_MQTT_VERSION or so and then creates either a hivemq version 5 or 3.x client.

Anton Tananaeva year ago

Are you saying MQTT is not backwards compatible?