Quandify configuration

Configuration guide

To add a Quandify sensor to a Milesight gateway, follow the instructions in this guide:

To connect the Milesight gateway to UMA's MQTT server follow the instructions in this guide:

Unsure about UMA's MQTT server details? Click here.

Payload codec

In order for our server to correctly understand messages sent from Quandify sensors you will need to create a custom payload codec on the Milesight gateway. Use the following decoder:

function Decode(fPort, bytes, LoRaObject) {
  var data = {};

  if (!bytes || bytes.length !== 28) {
    data.errors = ["Payload missing or wrong length"];
    return data;
  }
  if (fPort !== 1) {
    data.errors = ["Not a status report"];
    return data;
  }

  function toUInt16LE(b, i) { return b[i] | (b[i+1] << 8); }
  function toUInt32LE(b, i) { return b[i] | (b[i+1] << 8) | (b[i+2] << 16) | (b[i+3] << 24); }
  function toBattery(v) { return 1800 + v * 8; }
  function toTemperature(v) { return (v / 2) - 20; }

  var errorField = toUInt16LE(bytes, 4);

  data.uptime = toUInt32LE(bytes, 0);
  data.errorCode = errorField & 0x7fff;
  data.isSensing = !(errorField & 0x8000);
  data.totalVolume = toUInt32LE(bytes, 6);
  data.totalHeat = toUInt32LE(bytes, 10);
  data.leakState = bytes[22];
  data.batteryActive = toBattery(bytes[23]);
  data.batteryRecovered = toBattery(bytes[24]);
  data.waterTemperatureMin = toTemperature(bytes[25]);
  data.waterTemperatureMax = toTemperature(bytes[26]);
  data.ambientTemperature = toTemperature(bytes[27]);

  if (LoRaObject) {
    data.devEUI = LoRaObject.devEUI;
    data.rssi = LoRaObject.rxInfo && LoRaObject.rxInfo[0] ? LoRaObject.rxInfo[0].rssi : null;
    data.snr = LoRaObject.rxInfo && LoRaObject.rxInfo[0] ? LoRaObject.rxInfo[0].loRaSNR : null;
    data.rawData = LoRaObject.data;
    data.time = LoRaObject.time ? LoRaObject.time : new Date().toISOString();
  } else {
    data.time = new Date().toISOString();
  }

  return data;
}

Application setup

In order for our server to correctly understand uplinks and downlinks from our server you will need to configure the application on the gateway with the following topic:

Uplink topic - quandify

Add the device to UMA

To add a Quandify sensor to UMA, you will need the Dev EUI which can be obtained either locally on the sensor or from your distributor. Use the Dev EUI as the UMA ID.

When adding a Quandify device in UMA, click on add device and then use the Quandify card to find the device you want to add.

After some minutes, the device will come online and you will start recording the data coming from the sensor.

Last updated

Was this helpful?