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

This plugin is part of the Kuzzle Enterprise Plan. If you are interested, please contact us.

decode #

This method must be implemented in order to decode the payload.

It has to return a promise resolving to a DeviceContent with the following information:

  • reference: device identifier
  • measures: measures received in the payload
  • qos: additional information about device state like battery, etc. (optional)
Copied to clipboard!
abstract decode (payload: JSONObject, request: KuzzleRequest): Promise<DeviceContent>

Arguments Type Description
Raw payload received in the API action body
API request of origin

Returns #

Returns a promise resolving to a DeviceContent.

Usage #

Considering the following payload:

Copied to clipboard!
  deviceEUI: '12345',
  register55: 23.3,
  batteryLevel: 0.8,

The following decode method could be implemented:

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

class KarakoyDecoder extends Decoder {
  // [...]
  async decode (payload: JSONObject, request: KuzzleRequest): Promise<DeviceContent> {
    const deviceContent: DeviceContent = {
      reference: payload.deviceEUI,
      measures: {
        temperature: {
          value: payload.register55,
      qos: {
        battery: payload.batteryLevel * 100

    return deviceContent;