Skip to main content

Fuel Analysis

This guide covers the end-to-end setup required to enable the Fuel Analysis plugin for a client's fleet. The integration allows real-time fuel data forwarding, vehicle synchronization, and automatic refuel detection.

Overview

The Fuel Analysis plugin connects FMDP with the TrackSynQ Fuel Analysis service through:

  1. Fuel Data Forwarding — Real-time fuel level data from devices is forwarded to the Fuel Analysis API
  2. Vehicle Sync — Vehicles are automatically synced every 30 minutes to keep the Fuel Analysis service updated
  3. Auto Refuel Capture — Daily analysis detects refueling events from fuel level patterns

Prerequisites

Before setting up the integration, ensure:

  • The client has devices with fuel sensors (analog fuel rod or LV-CAN200)
  • The Fuel Analysis plugin is enabled for the client's application
  • Access to both the Super Admin Portal and Management Portal

Step 1: Create the FuelAnalysis Backend Server

Portal

Super Admin Portal → Configurations → Backends

Navigate to Super Admin Portal → Configurations → Backends and click Add New.

Configure the backend with the following settings:

FieldValue
NameFuelAnalysis
Protocolhttps
HostSee environment table below
Port443
Endpoint/fuelanalysis/v3/fueldata/datapoints
Backend TypeFuelAnalysis
Enabledtrue
Forwarding Optionprocessed_data
Timeout30
Maximum Retry Count1

Environment-specific Host Values

EnvironmentHost
Devapis.dev.services.tracksynq.com
Productionapis.services.tracksynq.com

HTTP Headers

Add the following HTTP header:

Header NameHeader Value
x-api-keyThe Fuel Analysis API key (contact DevOps for the key)

FuelAnalysis Backend Configuration

Step 2: Create Vehicle Custom Fields

Portal

Management Portal → Configurations → Custom Fields

Navigate to Management Portal → Configurations → Custom Fields and create the following custom fields with Asset Type set to Vehicle:

fuel_tank_capacity

FieldValue
Asset TypeVehicle
Namefuel_tank_capacity
LabelFuel Tank Capacity
Field TypeString
Min0
Max1000

fuel_tank_capacity custom field

fuel_unit

FieldValue
Asset TypeVehicle
Namefuel_unit
LabelFuel Unit
Field TypeString
PlaceholderLITER

fuel_unit custom field

fuel_tank_calibration

FieldValue
Asset TypeVehicle
Namefuel_tank_calibration
LabelFuel Tank Calibration
Field TypeString

fuel_tank_calibration custom field

auto_refuel_capture_lookback_days

FieldValue
Asset TypeVehicle
Nameauto_refuel_capture_lookback_days
LabelAuto Refuel Capture Lookback Days
Field TypeString
Min1
Max100
Regex^[1-9][0-9]?$|^100$

auto_refuel_capture_lookback_days custom field

Step 3: Set Up Device and Vehicle Groups

Portal

Management Portal → Groups

Create dedicated device and vehicle groups to organize assets for fuel analysis:

Device Group

  1. Navigate to Management Portal → Groups → Device Groups
  2. Click Add New
  3. Set the group name to Fuel Analysis
  4. Add all devices that have fuel sensors to this group

Vehicle Group

  1. Navigate to Management Portal → Groups → Vehicle Groups
  2. Click Add New
  3. Set the group name to Fuel Analysis
  4. Add all vehicles associated with fuel sensor devices to this group
tip

Grouping fuel-sensor devices and their vehicles together makes it easier to manage backend assignments and troubleshoot forwarding issues.

Fuel Analysis Groups

Step 4: Assign Backend to Devices

Portal

Management Portal → Devices

Assign the FuelAnalysis backend to each device in the "Fuel Analysis" device group:

  1. Navigate to Management Portal → Devices
  2. Search/filter by the Fuel Analysis group name
  3. Select a device from the list
  4. In the device form, find the Backend Servers section
  5. Add the FuelAnalysis backend created in Step 1
  6. Click Save
  7. Repeat for each device in the group
tip

Only assign the FuelAnalysis backend to devices that have fuel sensors configured. Devices without fuel data will generate errors in the forwarding logs.

Device Backend Assignment

Step 5: Populate Vehicle Custom Fields

Portal

Management Portal → Vehicles

For each vehicle in the Fuel Analysis vehicle group, populate the custom fields created in Step 2:

  1. Navigate to Management Portal → Vehicles
  2. Search/filter by the Fuel Analysis vehicle group
  3. Select a vehicle
  4. Fill in the custom fields:
    • fuel_tank_capacity — Enter the tank capacity in liters (e.g. 45)
    • fuel_unit — Set to LITER
    • fuel_tank_calibration — Add calibration data if available
    • auto_refuel_capture_lookback_days — Set lookback period (default: 30)
  5. Click Save
  6. Repeat for all vehicles in the group

Vehicle Custom Fields Configuration

Step 6: Verify the Integration

After completing the setup, verify the integration is working correctly:

Fuel Data Forwarding

  • Check the backend's forwarding logs for successful 200 OK responses
  • If you see 404 errors with "Vehicle is not registered", wait for the next vehicle sync cycle (every 30 minutes)

Vehicle Sync

  • Vehicles should appear in the Fuel Analysis service within 30 minutes of setup
  • Vehicle identifier format: {clientId}_{plateNumber}

Auto Refuel Capture

  • Refuel events are detected daily based on fuel level patterns
  • A significant increase in fuel percentage (e.g., from 20% to 80%) triggers a refuel detection

Troubleshooting

IssueCauseSolution
404 "Vehicle is not registered"Vehicle not yet syncedWait 30 minutes for the next sync cycle
401 UnauthorizedInvalid API keyVerify the x-api-key header value
No fuel data forwardedDevice not assigned to backendCheck device backend assignment (Step 4)
Fuel percentage always 0Device fuel sensor not configuredCheck device variable mapping for fuel percentage
No refuel events detectedLookback days too short or no significant fuel increaseIncrease auto_refuel_capture_lookback_days or verify fuel data patterns

Architecture Reference

┌──────────────────────────────────────────────────────────────────────┐
│ FMDP Platform │
│ │
│ 🔌 Device ──▶ ⚙️ Adapter ──▶ 📡 Forwarder (FuelAnalysis Backend) │
│ │ │
│ ▼ │
│ Fuel Analysis Service │
│ POST /fueldata/datapoints │
│ │
├──────────────────────────────────────────────────────────────────────┤
│ Integration Workers │
│ │
│ 🔄 VehicleSyncWorker (every 30 min) ──▶ POST /vehicles/sync │
│ ⛽ AutoRefuelCaptureWorker (daily) ──▶ POST /refuel/autorefuelcapture │
└──────────────────────────────────────────────────────────────────────┘