Traccar Server
Traccar uses GPS for tracking and has support for over 1500 different types of devices. You can use the Traccar Server integration to communicate with your own Traccar Server, which is also available as Home Assistant add-on.
Looking for documentation on how to set up the Traccar Client with webhooks in Home Assistant? See the Traccar Client integration documentation.
Configuration
To add the Traccar Server integration to your Home Assistant instance, use this My button:
Manual configuration steps
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select Traccar Server.
-
Follow the instructions on screen to complete the setup.
Events
The Traccar Server integration options allow you to define a list of events you want to listen for. These events will be sent to Home Assistant as events.
All events will be prefixed with traccar_ followed by a snake_cased version of the event name.
Examples:
- The
deviceMovingwill be fired in Home Assistant astraccar_device_moving. - The
geofenceExitwill be fired in Home Assistant astraccar_geofence_exit. - The
alarmwill be fired in Home Assistant astraccar_alarm.
All events will also have the following data:
Example
{
"device_traccar_id": 24,
"device_name": "My Device",
"type": "alarm",
"serverTime": "1970-01-01T00:00:00.000Z",
"attributes": {
"custom_attribute": "value"
},
}
Devices
The Traccar Server integration will create devices for each device registered in the Traccar Server with at least one position update.
These device representations in Home Assistant will have entities associated with them, which you can use in automations, scripts, and display on your dashboard.
Entities
The traccar server integration will create entities in with the following domains:
For more details about each of these, see the sections below.
Binary Sensor - Motion
The Traccar Server integration will create a binary_sensor entity for each device registered in Traccar Server to show the motion reported by the Traccar Server.
This entity is disabled by default.
The name of the sensor will be set to what you have named it in Traccar Server, followed by the term “Motion”. If your device is named “Millennium Falcon”, this will be “Millennium Falcon Motion”.
This will be the unique ID of the device tracker in Traccar Server followed by position_attributes_motion.
This entity does not have any attributes.
Binary Sensor - Status
The Traccar Server integration will create a binary_sensor entity for each device registered in Traccar Server to show the status reported by the Traccar Server.
This entity is disabled by default.
The name of the sensor will be set to what you have named it in Traccar Server followed by the term “Status”. If your device is named “Millennium Falcon”, this will be “Millennium Falcon Status”.
This will be the unique ID of the device tracker in Traccar Server followed by device_status.
This entity does not have any attributes.
Device Tracker
The Traccar Server integration will create a device tracker entity for each device registered in Traccar Server.
Attributes
In addition to the custom attributes you can define in the Traccar Server integration options, the device tracker entity will have the following attributes:
Sensor - Address
The Traccar Server integration will create a sensor entity for each device registered in Traccar Server to show the address reported by the Traccar Server.
This entity is disabled by default.
The name of the sensor will be set to what you have named it in Traccar Server followed by Address. If your device is named “Millennium Falcon”, this will be “Millennium Falcon Address”.
This will be the unique ID of the device tracker in Traccar Server followed by position_address.
This entity does not have any attributes.
Sensor - Altitude
The Traccar Server integration will create a sensor entity for each device registered in Traccar Server to show the altitude reported by the Traccar Server.
This entity is disabled by default.
The name of the sensor will be set to what you have named it in Traccar Server followed by Altitude. If your device is named “Millennium Falcon”, this will be “Millennium Falcon Altitude”.
This will be the unique ID of the device tracker in Traccar Server followed by position_altitude.
This entity does not have any attributes.
Sensor - Battery
The Traccar Server integration will create a sensor entity for each device registered in Traccar Server to show the remaining battery percentage reported by the Traccar Server.
This entity is disabled by default.
The name of the sensor will be set to what you have named it in Traccar Server followed by Battery. If your device is named “Millennium Falcon”, this will be “Millennium Falcon Battery”.
This will be the unique ID of the device tracker in Traccar Server followed by position_attributes.batteryLevel.
This entity does not have any attributes.
Sensor - Geofence
The Traccar Server integration will create a sensor entity for each device registered in Traccar Server to show the geofence reported by the Traccar Server.
This entity is disabled by default.
The name of the sensor will be set to what you have named it in Traccar Server followed by Geofence. If your device is named “Millennium Falcon”, this will be “Millennium Falcon Geofence”.
This will be the unique ID of the device tracker in Traccar Server followed by geofence_geofence.
This entity does not have any attributes.
Sensor - Speed
The Traccar Server integration will create a sensor entity for each device registered in Traccar Server to show the speed reported by the Traccar Server.
This entity is disabled by default.
The name of the sensor will be set to what you have named it in Traccar Server followed by Speed. If your device is named “Millennium Falcon”, this will be “Millennium Falcon Speed”.
This will be the unique ID of the device tracker in Traccar Server followed by position_speed.
This entity does not have any attributes.
Examples
So you set up the integration and it pulled in all your devices. Now what? Below are some examples of what you can do with the data provided by Traccar Server integration.
Automations
In this section you will find some example automations that you can use to get started with the Traccar Server integration.
Do something when a device enters a geofence
This automation allows you to do something when the device “Millennium Falcon” enters the defined geofence.
Prefer to configure this automation manually? Use the YAML below.
Automation YAML
Replace the placeholder values with values from your Home Assistant instance.
alias: Do something when a device enters a geofence
trigger:
- platform: state
entity_id: YOUR_DEVICES
to: YOUR_GEOFENCE
condition: []
action: []
mode: queued
Do something when a device is speeding
The allows you to do something when the device “Millennium Falcon” exceeds a defined speed.
Prefer to configure this automation manually? Use the YAML below.
Automation YAML
Replace the placeholder values with values from your Home Assistant instance.
alias: Do something when a device are speeding
trigger:
- platform: numeric_state
entity_id: YOUR_DEVICES
above: YOUR_SPEED
condition: []
action: []
mode: queued