Hi,
I want to integrate my Traccer server into my Home Assistant instance via MQTT. I want to track my cars as well as trigger different actions when any of the cars enters an area or leave it (at least this basic triggers).
I see the MQTT messages, so hopefully Traccar is already configured properly but I don’t know how to parse incoming MQTT messages in Home Assistant, make cars visible on the map and make scripts/automatons/etc work with.
Traccar can have more then just one car so it would be nice to avoid hardcoded car names in Home Assistant.
Any idea how to configure?
Here is an example MQTT message I get from Traccar:
{
"event": {
"id": 11640,
"attributes": {},
"deviceId": 1,
"type": "deviceStopped",
"eventTime": "2024-05-21T10:20:58.000+00:00",
"positionId": 1581151,
"geofenceId": 0,
"maintenanceId": 0
},
"position": {
"id": 1581151,
"attributes": {
"priority": 0,
"sat": 15,
"event": 0,
"ignition": false,
"motion": false,
"io80": 0,
"rssi": 5,
"io200": 0,
"io69": 1,
"io29": 0,
"io113": 87,
"io263": 1,
"io246": 0,
"io252": 0,
"pdop": 1.2000000000000002,
"hdop": 0.8,
"power": 12.717,
"io24": 0,
"io205": 5103,
"io206": 93,
"battery": 3.977,
"operator": 21630,
"distance": 0.0,
"totalDistance": 23500160.497852825,
"hours": 1802647310
},
"deviceId": 1,
"protocol": "teltonika",
"serverTime": "2024-05-21T10:21:01.739+00:00",
"deviceTime": "2024-05-21T10:20:58.000+00:00",
"fixTime": "2024-05-21T10:20:58.000+00:00",
"outdated": false,
"valid": true,
"latitude": REDACTED,
"longitude": REDACTED,
"altitude": 223.0,
"speed": 0.0,
"course": 291.0,
"address": null,
"accuracy": 0.0,
"network": null,
"geofenceIds": null
},
"device": {
"id": 1,
"attributes": {},
"groupId": 1,
"calendarId": 0,
"name": "MyOpelCar",
"uniqueId": "REDACTED",
"status": "online",
"lastUpdate": "2024-05-21T10:21:01.740+00:00",
"positionId": 1579232,
"phone": "REDACTED",
"model": "Opel",
"contact": null,
"category": "car",
"disabled": false,
"expirationTime": null
}
}