Assets - virtual entities for physical objects

flespi assets - virtual entities that enable device-independent tracking of physical resources like drivers, trailers, and vehicles across multiple devices with historical timeline management.

Essentials

  • Assets are virtual entities in flespi that represent physical objects or resources (like drivers, trailers, riders, or vehicles) that can be linked with different tracking devices over time.

  • Asset contains intervals - historical timeline of device associations, automatically maintained as non-overlapping time segments.

  • Assets can be assigned to calculators to enable asset-based interval detection and analysis.

  • Assets have a priority range from 0 to 100, with higher priority assets being checked first in case of intersections.

  • Assets can be organized into groups, similar to device grouping.

  • Note: Assets functionality is currently experimental and may be subject to changes or improvements in the future.

How assets work

Asset functionality is based on intervals registration which define when a device is linked to an asset. Each interval contains:

  • begin - interval start time
  • end - interval end time (0 means unlimited)
  • device_id - device linked to the asset during this interval (0 means no devices linked with this interval)
  • meta - custom data associated with this interval (up to 8KB of JSON)
  • timestamp - interval registration timestamp

Intervals are automatically managed to maintain a continuous and non-overlapping timeline. When a new interval is registered, the system recalculates existing intervals to ensure consistency.

To effectively "delete" an interval, you create a new interval with device_id=0 that overlaps with the target interval. This creates a corresponding period in the timeline.

Asset intervals are subject to the intervals_ttl setting of the asset, which determines how long intervals are stored in the database.

Analytics integration

Assets can be used standalone to maintain the historical timeline of device associations or together with devices and calculators to provide device/asset relationship context into analytical calculations. To provide such a context, assets should be assigned to the calculator either directly or through groups. 

Assigned assets can be accessed in all calculator expressions using special functions:

  • asset() - returns the asset with the highest ID to which the device was linked at the given time
  • assets() - returns an array of all assets to which the device was linked at the given time

These functions enable:

  • Interval splitting: Use asset/device intervals history to define interval boundaries in selectors
  • Asset tracking: Identify which assets were linked to a device during specific time periods in counters
  • Metadata access: Retrieve asset interval details including begin/end times, registration timestamp, and custom meta information

The asset() function accepts an optional parameter to specify which fields to return. For example: asset("name,id,interval") will return name id and asset interval properties such as device assignment begin, end time and its meta.

You can test if a device was assigned to any asset using: asset() != null. Or check if a device was not assigned to any asset with: isnull(asset()).

Calculator automatically triggers intervals recalculation for all assigned devices when its list of assigned assets changed and it has "update_onchange" option enabled. Independently from this option calculator will automatically recalculate intervals for all assigned devices upon any asset interval update for the corresponding time period.

How to create an asset?

Assets are currently in experimental mode and first you need to enable access to experimental features in your flespi panel. After that you may create a new asset:

  1. Log in to the flespi panel
  2. Navigate to Telematics hub -> Assets and click the "+" button
  3. Give the asset a name and click Save.
  4. Go to the Calculators or Groups tab for the asset and assign it to the entities you want to link it with.

Assets API

To perform any operations with the assets, use the assets API.

MQTT topics

You can monitor asset intervals via MQTT topics:

  • flespi/interval/gw/assets/{asset_id}/created - asset interval was created
  • flespi/interval/gw/assets/{asset_id}/updated - asset interval was updated
  • flespi/interval/gw/assets/{asset_id}/deleted - asset interval was deleted
  • flespi/state/gw/assets/{asset_id}/last_interval - contains the latest interval

Messages posted in asset MQTT topics contain a 'trace' user property which you can use to link actual interval modification events with REST API calls.

Troubleshooting

In case of any issues, check the Logs tab. There you will find all modifications that were done to an asset within the last 365 days including any interval event.