Processing OsmAnd Protocol Attributes with Server Logic
Implementing custom automation rules on a telematics server requires precise data parsing mechanisms. When managing modern mobile platforms and hardware endpoints, optimizing your platform logic is essential for processing incoming telemetry streams. This technical guide focuses entirely on configuring raw operational properties into actionable platform alerts using advanced jexl expressions.
The core foundation of this environment relies on managing incoming osmand protocol attributes. Because this standard transmits telematics data using structured HTTP query keys (such as deviceid, lat, lon, and batteryLevel) rather than obfuscated binary strings, it allows for highly transparent server communication monitoring. To transform these simple variables into intelligent system triggers, administrators utilize Traccar's built-in computed attribute syntax engines.
Before launching advanced scripts across your deployed tracking clients, it is crucial to analyze how the platform handles incoming telemetry fields. Every single position update evaluated by the execution engine checks the variables for null states to avoid backend performance bottlenecking. Below is the step-by-step documentation of exact system attributes with multiple practical problem-and-solution expressions.
1. The 'batteryLevel' Attribute (Battery Status Monitoring)
The batteryLevel attribute reflects the current charge percentage of the tracking client. Below are two distinct production scenarios using JEXL to transform this integer value into active alarms.
Scenario A: Critical Low Battery Notification with Live Percentage
Goal: Trigger an alarm only when the battery drops below 15%, while embedding the exact live percentage within the notification string for the dispatch operators.
Step-by-Step Implementation:
- Navigate to Settings ➡️ Computed Attributes and click the plus icon.
- Set Attribute to
Alarmand Type toString. - Paste the following syntax into the expression box:
batteryLevel != null ? (batteryLevel < 15 ? "Low Battery: %" + batteryLevel : null) : null
Scenario B: Battery Health Check Filter (Suppressing Zero-Value Noise)
Goal: Sometimes hardware clients temporarily report a glitchy 0% value when booting up. This formula ignores absolute zero values but captures authentic critical ranges between 1% and 10%.
Step-by-Step Implementation:
- Create a new Computed Attribute row.
- Select
Alarmand ensure the type is set toString. - Apply the nested range expression:
batteryLevel != null ? (batteryLevel > 0 && batteryLevel <= 10 ? "Battery Critical Health Warning" : null) : null
2. The 'charge' Attribute (Power Source Connectivity)
The charge key acts as a boolean indicator showing whether the device is receiving external electricity via its USB port or vehicle wire harness.
Scenario A: Main Power Line Disconnection Warning
Goal: Generate an immediate security alert the exact second a device is unplugged or the vehicle fuse blows, meaning the hardware has switched to standalone internal battery power.
Step-by-Step Implementation:
- Go to the attribute creation screen, set Attribute to
Alarm. - Input the validation check phrase below:
charge != null ? (!charge ? "Power Cut / Cable Unplugged" : null) : null
Scenario B: Power Restoration Validation Event
Goal: Notify fleet supervisors when a previously dead or disconnected asset is successfully reconnected to a functional charging station or active car battery.
Step-by-Step Implementation:
- Set up an attribute with
Alarmparameter outputs. - Write the verification loop:
charge != null ? (charge ? "Charging Initialized" : null) : null
3. The 'motion' Attribute (Movement & Theft Detection)
The motion attribute is a boolean flag indicating whether the internal accelerometer or consecutive GPS coordinates detect physical displacement. Utilizing this property with JEXL allows for robust vehicle security filters.
Scenario A: Unauthorized Towing and Theft Protection Alert
Goal: Trigger a high-priority theft alarm if the tracking client reports physical motion while the vehicle is supposed to be completely stationary or during late-night hours when parked.
Step-by-Step Implementation:
- Navigate to Settings ➡️ Computed Attributes on your administration dashboard.
- Select Alarm from the main dropdown menu and keep the Type as
String. - Input the following logical conditional check into the expression field:
motion != null ? (motion && speed < 2 ? "Theft Warning: Towing Detected" : null) : null
Scenario B: Virtual Idle State Engine Mapping
Goal: Map a custom attribute to identify when an asset is stationary but its state remains unresolved, creating a clean diagnostic metric for tracking continuous idle periods.
Step-by-Step Implementation:
- Create a clean configuration line in your attributes module.
- Set the target mapping identifier to
Alarmwith aStringvariable output. - Apply this exact syntax validation rule:
motion != null ? (!motion && speed == 0 ? "Asset Idle Status Confirmed" : null) : null
4. The 'valid' Attribute (GPS Signal Quality Assurance)
The valid property is a critical system flag confirming whether the incoming latitude and longitude coordinates are actively locked onto actual satellites or merely reporting cached, inaccurate data.
Scenario A: Underground Parking or Tunnel Blackout Monitor
Goal: Alert dispatch operators the exact second a tracking terminal enters an underground garage, deep tunnel, or urban canyon where satellite tracking becomes compromised.
Step-by-Step Implementation:
- Go to your system parameters panel and initiate an attribute build process.
- Choose
Alarmand ensure the computational profile is saved asString. - Paste the boolean inverse formula into the script configuration container:
valid != null ? (!valid ? "GPS Signal Lost / Indoor Area" : null) : null
Scenario B: Automated Invalid Data Coordinate Filter
Goal: Prevent false geofence triggers by generating a diagnostic tag when a hardware client pushes erratic jumps onto the map grid while lacking a clear sky fix.
Step-by-Step Implementation:
- Add a new line, selecting
Alarmfrom the system properties cluster. - Set the format to
Stringand load the conditional block below:
valid != null && speed != null ? (!valid && speed > 0 ? "Unverified Location Data Skew" : null) : null
5. The 'accuracy' Attribute (Data Precision Control)
The accuracy parameter represents the GPS Dilution of Precision (HDOP) measured in kilometers. Monitoring this field prevents ghost tracking issues caused by cellular triangulation jumps.
Scenario A: High Precision Threshold Guard
Goal: Trigger an alarm if the positioning accuracy drops beyond an acceptable metric boundary (e.g., 50 meters), flagging potentially drifted tracking positions.
Step-by-Step Implementation:
- Open the Computed Attributes panel in your platform settings.
- Set the Attribute field to
Alarmand chooseStringas your type. - Paste this boundary detection rule into the evaluation terminal:
accuracy != null ? (accuracy > 0.05 ? "Low GPS Accuracy Detected" : null) : null
Scenario B: Multi-Variable Accuracy & Speed Validation
Goal: Suppress false speeding alarms by verifying that high-speed updates are only acknowledged when the satellite signal precision is perfectly intact.
Step-by-Step Implementation:
- Create a diagnostic validation line within your server dashboard.
- Select
Alarmfrom the drop-down menu and save the core format asString. - Incorporate this conditional checking mechanism:
accuracy != null && speed != null ? (speed > 50 && accuracy > 0.1 ? "Suspicious Speed Data (Bad GPS Accuracy)" : null) : null
6. The 'speed' Attribute (Intelligent Velocity Mapping)
Traccar natively processes and stores internal velocity values in knots. Managing the speed attribute using JEXL allows for real-time mathematical conversions into localized metrics like km/h.
Scenario A: Automated Knot to KM/H Overspeed Logger
Goal: Check if a vehicle passes the 120 km/h threshold (equal to 64.79 knots) and output the mathematically converted real km/h speed value directly in the alert string.
Step-by-Step Implementation:
- Go to your settings tab, select
Alarmfrom the system properties cluster. - Input this math-driven expression to dynamically parse the target speeds:
speed != null ? (speed > 64.79 ? "Overspeed: " + Math.round(speed * 1.852) + " km/h" : null) : null
Scenario B: Virtual Ignition Simulation via Velocity
Goal: Simulate a logical ignition state switch for mobile tracking devices that do not have access to a vehicle's physical engine wire harness.
Step-by-Step Implementation:
- Add a new line, selecting
ignitionfrom the system parameters cluster. - Crucially, set the Type option to
Booleaninstead of String. - Load the kinetic state validation script below:
speed != null ? (speed > 1.5 ? true : false) : null
By mastering the computed attribute syntax rules detailed throughout this guide, telematics administrators can drastically reduce false alarms while extracting high-utility tracking behaviors from basic osmand protocol attributes. Implementing proper null-pointer logic via JEXL guarantees flawless server communication efficiency across all active tracking endpoints. For further assistance with custom server scripting, contact our engineering support channels today.