Fleet API

Queries

The query domains for the Fleet API are

developmentb16x17
productionfuse_fleet

The production version is always pre-pended to the production query domain with a period, so for version 1 of the API would use v1_fuse_trips as the query domain. In this document we will use the production query domain without the version. See Fuse Base URLs for more information on how to turn the descriptions shown here into a query URL. 

fuse_fleet:vehicleChannels()

Query the fleet for a the current vehicle channels. The result is an array of objects that associate a picoId with the current channel for that vehicle.

You should avoid using the channel as a means of identifying the vehicle since it could change. This function always provides the current mapping from the vehicle canonical name in the system, the picoId, and the pico channel.

 

fuse_fleet:vehicleStatus()

Queries the fleet for the current vehicle statuses. The function returns an array of vehicle status information (i.e., latest data elements from Carvoyant) with the following properties:

KeyDescription
GEN_DTCDiagnostic Trouble Codes 
GEN_VOLTAGEBattery Voltage
GEN_TRIP_MILEAGETrip Mileage (calculate from ignition on to ignition off via GPS)
GEN_ODOMETERVehicle Reported Odometer (not available on all makes and models)
GEN_WAYPOINTGPS Location
GEN_HEADINGHeading (degrees clockwise from due north)
GEN_RPMEngine Speed
GEN_FUELLEVELPercentage of Fuel Remaining (not available on all makes and models)
GEN_FUELRATERate of Fuel Consumption
GEN_ENGINE_COOLANT_TEMPEngine Temperature
GEN_SPEED Maximum Speed Recorded (since the previous reading)

fuse_fleet:vehicleSummary()

Queries the fleet for the latest vehicle summary. The result is an array of objects with the following properties:

KeyDescription
DTCObject containing latest code with ID and timestamp
addressLast known address of vehicle
channelVehicle channel
deviceIdCarvoyant device identifier
fuellevelPercentage of fuel remaining (not available on all vehicles)
headingHeading (degrees clockwise from due north)
labelNickname for vehicle (owner assigned)
lastRunningTimestampTimestamp as of last time the vehicle sent an ignitionStatus event of "OFF"
lastWaypointWaypoint as of last time the vehicle sent an ignitionStatus event of "OFF"
makeMake of vehicle as calculated from the VIN
mileageMileage as of last time the vehicle sent an ignitionStatus event of "OFF"
modelModel of vehicle as calculated from the VIN
nameName of vehicle as calculated from the VIN
picoIdThe identifier for the vehicle's pico.
profileNameOwner name for vehicle (currently the same as "label")
profilePhotoPhoto badge for vehicle
speedSpeed as of last time the vehicle sent an ignitionStatus event of "OFF"
vehicleIdCarvoyant vehicleId (presence is a good indication that vehicle is linked to Carvoyant)
vinVehicle Identification Number (owner reported)
yearYear of vehicle as calculated from the VIN

fuse_fleet:tripsSummary(<year>, <month>)

Query fleet for summary of vehicle trips. See the Trips API description for general information about trips. 

The parameters are a year given as a four digit string (e.g. "2014") and a month given as a two digit string (e.g. "08" for August)

The result is an array of objects with the following properties:

KeyDescription
costtotal cost of all trips
intervaltotal length of all trips in seconds
mileagetotal length of all trips in distance units (Fuse is unit agnostic)
picoIdpico identifier
trip_counttotal number of trips for month

fuse_fleet:fuelSummary(<year>, <month>)

Query fleet for summary of vehicle fillups. See the Fuel API description for general information about fuel. 

The parameters are a year given as a four digit string (e.g. "2014") and a month given as a two digit string (e.g. "08" for August)

The result is an array of objects with the following properties:

KeyDescription
costtotal cost of all fillups in the given month
distancetotal distance driven between fillups
fillupsnumber of fillups
picoIdpico identifier
volumevolume of fillups (e.g. gallons, liters, etc.)

 

Events

Services

The following services operate in the fleet API

fuse_fleet:create_vehicle

Selector:

select when fuse need_new_vehicle

Synopsis:

Creates a new vehicle in the fleet. 

Idempotent. Will not create a vehicle that already exists (as identified by VIN and Device ID)

Uses:
  • vin - Vehicle identification numbner
  • deviceId - Fuse device identifier
  • name - vehicle name (free form)
Raises:

cloudos:picoAttrSet

cloudod:subscribe

fuse_fleet:delete_vehicle

Selector:

select when fuse delete_vehicle

Synopsis:

Deletes a vehicle from the fleet. 

Uses:

  • vehicle_name - Pico name for vehicle to delete
Raises:

cloudos:picoAttrClear

cloudod:unsubscribe

carvoyant:vehicle_not_needed

fuse_fleet:find_fuse_carvoyant_diffs

Selector:

select when fuse fleet_updated

Synopsis:

Finds differences between vehicle records for Fuse fleet and vehicle records in Carvoyant. Used a guard rule for syncing fleet with Carvoyant. 

Uses:
Raises:

fuse:vehicles_not_in_carvoyant when fired

fuse_fleet:sync_fuse_with_carvoyant

Selector:

select when fuse vehicles_not_in_carvoyant

Synopsis:

Synchronizes the Fuse fleet and vehicle records in Carvoyant.

Works by send a carvoyant:init_vehicle event to each vehicle that needs to be updated. 

Uses:
  • vehicle_data - array of picoIds for any vehicles not in sync

Raises:

fuse:vehicles_not_in_carvoyant when fired

fuse_fleet:update_vehicle_data_in_fleet

Selector:

select when fuse updated_vehicle

Synopsis:

Catches data transmissions from the vehicle to the fleet. 

Uses:
  • keyvalue - the type of data being updated along with a key

  • value - a map of the data to be stored. 

Raises:

none