Fleet API
Queries
The query domains for the Fleet API are
development | b16x17 |
---|---|
production | fuse_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:
Key | Description |
---|---|
GEN_DTC | Diagnostic Trouble Codes |
GEN_VOLTAGE | Battery Voltage |
GEN_TRIP_MILEAGE | Trip Mileage (calculate from ignition on to ignition off via GPS) |
GEN_ODOMETER | Vehicle Reported Odometer (not available on all makes and models) |
GEN_WAYPOINT | GPS Location |
GEN_HEADING | Heading (degrees clockwise from due north) |
GEN_RPM | Engine Speed |
GEN_FUELLEVEL | Percentage of Fuel Remaining (not available on all makes and models) |
GEN_FUELRATE | Rate of Fuel Consumption |
GEN_ENGINE_COOLANT_TEMP | Engine 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:
Key | Description |
---|---|
DTC | Object containing latest code with ID and timestamp |
address | Last known address of vehicle |
channel | Vehicle channel |
deviceId | Carvoyant device identifier |
fuellevel | Percentage of fuel remaining (not available on all vehicles) |
heading | Heading (degrees clockwise from due north) |
label | Nickname for vehicle (owner assigned) |
lastRunningTimestamp | Timestamp as of last time the vehicle sent an ignitionStatus event of "OFF" |
lastWaypoint | Waypoint as of last time the vehicle sent an ignitionStatus event of "OFF" |
make | Make of vehicle as calculated from the VIN |
mileage | Mileage as of last time the vehicle sent an ignitionStatus event of "OFF" |
model | Model of vehicle as calculated from the VIN |
name | Name of vehicle as calculated from the VIN |
picoId | The identifier for the vehicle's pico. |
profileName | Owner name for vehicle (currently the same as "label") |
profilePhoto | Photo badge for vehicle |
speed | Speed as of last time the vehicle sent an ignitionStatus event of "OFF" |
vehicleId | Carvoyant vehicleId (presence is a good indication that vehicle is linked to Carvoyant) |
vin | Vehicle Identification Number (owner reported) |
year | Year 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:
Key | Description |
---|---|
cost | total cost of all trips |
interval | total length of all trips in seconds |
mileage | total length of all trips in distance units (Fuse is unit agnostic) |
picoId | pico identifier |
trip_count | total 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:
Key | Description |
---|---|
cost | total cost of all fillups in the given month |
distance | total distance driven between fillups |
fillups | number of fillups |
picoId | pico identifier |
volume | volume of fillups (e.g. gallons, liters, etc.) |
Events
Services
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 keyvalue
- a map of the data to be stored.
Raises:
none