Official Plugins (Kuzzle v2.x)
Device Manager v0.x

copyToAsset #

Build the measures property that will be persisted in the asset document.

By default this method will copy the measures with device and qos information.

Copied to clipboard!
copyToAsset (device: Device, request: KuzzleRequest): Promise<AssetMeasures>

Arguments Type Description
Device document
Original request

Returns #

Returns a promise resolving to an AssetMeasures.

Usage #

Copied to clipboard!
import { KuzzleRequest } from 'kuzzle';
import { Decoder, AssetMeasures } from 'kuzzle-plugin-device-manager';

class KarakoyDecoder extends Decoder {
  // [...]
  async copyToAsset (device: Device): Promise<AssetMeasures> {
    const measures = {};

    for (const [measureType, measure] of Object.entries(device._source.measures)) {
      measures[measureType] = {
        id: device._id,
        model: device._source.model,
        reference: device._source.reference,
        qos: device._source.qos,

    return measures;

This is the default code for the copyToAsset method.