> For the complete documentation index, see [llms.txt](https://docs.mclimate.eu/mclimate-lorawan-devices/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mclimate.eu/mclimate-lorawan-devices/devices/mclimate-co2-display-lite/decoding-and-bacnet-object-mapping/bacnet-codec-and-definition-files/milesight.md).

# Milesight

## Creation procedure <a href="#network-server-payload-codec-custom-payload-codec" id="network-server-payload-codec-custom-payload-codec"></a>

### **Network Server → Payload Codec → Custom Payload Codec** <a href="#network-server-payload-codec-custom-payload-codec" id="network-server-payload-codec-custom-payload-codec"></a>

Copy and paste each of the following in their respective fields:

### **Payload Decoder Function**

```js
// DataCake
function Decoder(bytes, port) {
    var decoded = decodeUplink({ bytes: bytes, fPort: port }).data;
    return decoded;
}

// Milesight
function Decode(port, bytes) {
    var decoded = decodeUplink({ bytes: bytes, fPort: port }).data;
    return decoded;
}

// The Things Industries / Main
function decodeUplink(input) {
    try {
        var bytes = input.bytes;
        var data = {};

        var calculateTemperature = function (rawData) {
            return (rawData - 400) / 10;
        };
        var calculateHumidity = function (rawData) {
            return (rawData * 100) / 256;
        };

        var handleKeepalive = function (bytes, data) {
            var temperatureRaw = (bytes[1] << 8) | bytes[2];
            data.sensorTemperature = Number(calculateTemperature(temperatureRaw).toFixed(2));

            data.relativeHumidity = Number(calculateHumidity(bytes[3]).toFixed(2));

            var batteryVoltageRaw = (bytes[4] << 8) | bytes[5];
            // Converted to Volts (raw is mV) -- matches the PIR mini/FCT battery-
            // reading convention and lets the BACnet object use the safe, well-
            // established UNITS_VOLTS (5) id instead of guessing an obscure
            // millivolts unit code.
            data.batteryVoltage = Number((batteryVoltageRaw / 1000).toFixed(2));

            var co2Low = bytes[6];
            var co2High = (bytes[7] & 0xF8) >> 3;
            data.CO2 = (co2High << 8) | co2Low;

            data.powerSourceStatus = bytes[7] & 0x07;

            var lightIntensityRaw = (bytes[8] << 8) | bytes[9];
            data.lux = lightIntensityRaw;

            return data;
        };

        var handleResponse = function (bytes, data) {
            var commands = bytes.map(function (byte) {
                return ("0" + byte.toString(16)).substr(-2);
            });
            commands = commands.slice(0, -10);
            var command_len = 0;

            commands.map(function (command, i) {
                switch (command) {
                    case '04': {
                        command_len = 2;
                        // Nibble-encoded: primary=byte>>4, secondary=byte&0xF
                        // (see digest section 11 -- authoritative nibble-decode
                        // formula, NOT the inconsistent prose example on the doc
                        // page, which is flagged there as internally contradictory).
                        var hwByte = parseInt(commands[i + 1], 16);
                        var swByte = parseInt(commands[i + 2], 16);
                        data.deviceHardwareVersion = ((hwByte >> 4) & 0x0F) + ((hwByte & 0x0F) / 10);
                        data.deviceSoftwareVersion = ((swByte >> 4) & 0x0F) + ((swByte & 0x0F) / 10);
                        break;
                    }
                    case '12': {
                        command_len = 1;
                        data.keepAliveTime = parseInt(commands[i + 1], 16);
                        break;
                    }
                    case '14': {
                        command_len = 1;
                        data.childLock = parseInt(commands[i + 1], 16); // 0/1
                        break;
                    }
                    case '19': {
                        command_len = 1;
                        // raw*5 seconds -> minutes
                        data.joinRetryPeriod = parseInt(commands[i + 1], 16) * 5 / 60;
                        break;
                    }
                    case '1b': {
                        command_len = 1;
                        data.uplinkType = parseInt(commands[i + 1], 16); // 0 unconf, 1 conf
                        break;
                    }
                    case '1d': {
                        command_len = 2;
                        // DELIBERATE DEVIATION from the published decoder's
                        // raw*5+7-minutes formula for the confirmed field --
                        // plain raw numbers, matching the FCT decoder's D9
                        // precedent (see header note above).
                        data.watchDogPeriodConfirmed = parseInt(commands[i + 1], 16);
                        data.watchDogPeriodUnconfirmed = parseInt(commands[i + 2], 16);
                        break;
                    }
                    case '1f': {
                        command_len = 4;
                        data.co2BoundaryGoodMedium =
                            (parseInt(commands[i + 1], 16) << 8) | parseInt(commands[i + 2], 16);
                        data.co2BoundaryMediumBad =
                            (parseInt(commands[i + 3], 16) << 8) | parseInt(commands[i + 4], 16);
                        break;
                    }
                    case '21': {
                        command_len = 2;
                        data.co2AutoZeroValue =
                            (parseInt(commands[i + 1], 16) << 8) | parseInt(commands[i + 2], 16);
                        break;
                    }
                    case '25': {
                        command_len = 3;
                        data.co2MeasurementPeriodGood = parseInt(commands[i + 1], 16);
                        data.co2MeasurementPeriodMedium = parseInt(commands[i + 2], 16);
                        data.co2MeasurementPeriodBad = parseInt(commands[i + 3], 16);
                        break;
                    }
                    case '2b': {
                        command_len = 1;
                        data.co2AutoZeroPeriod = parseInt(commands[i + 1], 16);
                        break;
                    }
                    case '2f': { // ADDED (A3): fw>=1.3, missing from published decoder
                        command_len = 1;
                        data.uplinkOnButtonPress = parseInt(commands[i + 1], 16); // 0/1
                        break;
                    }
                    case '34': {
                        command_len = 1;
                        data.fullDisplayRefreshPeriod = parseInt(commands[i + 1], 16); // hours
                        break;
                    }
                    case '41': {
                        command_len = 1;
                        data.showTemperature = parseInt(commands[i + 1], 16); // 0 hidden, 1 shown
                        break;
                    }
                    case '43': {
                        command_len = 1;
                        data.showHumidity = parseInt(commands[i + 1], 16);
                        break;
                    }
                    case '45': {
                        command_len = 1;
                        data.showLightIntensity = parseInt(commands[i + 1], 16);
                        break;
                    }
                    case '80': {
                        command_len = 1;
                        data.co2MeasuringBlindTime = parseInt(commands[i + 1], 16); // minutes
                        break;
                    }
                    case '83': { // ADDED (A2): missing from published decoder
                        command_len = 1;
                        data.co2DisplayMode = parseInt(commands[i + 1], 16); // 2-bit flags 0-3
                        break;
                    }
                    case 'a4': { // ADDED (A1): missing from published decoder
                        command_len = 1;
                        data.lorawanRegion = parseInt(commands[i + 1], 16); // 0-3
                        break;
                    }
                    case 'a0': {
                        // Undocumented in the commands cheat sheet -- FUOTA multicast
                        // address readback, 4-byte big-endian. Decoder-only, NOT a
                        // BACnet object (no gen_definition.py entry emits it).
                        command_len = 4;
                        var fuota_address = (parseInt(commands[i + 1], 16) << 24) |
                                          (parseInt(commands[i + 2], 16) << 16) |
                                          (parseInt(commands[i + 3], 16) << 8) |
                                          parseInt(commands[i + 4], 16);
                        data.fuotaAddress = fuota_address;
                        break;
                    }
                    default:
                        break;
                }
                commands.splice(i, command_len);
            });
            return data;
        };

        if (bytes[0] == 1) {
            data = handleKeepalive(bytes, data);
        } else {
            data = handleResponse(bytes, data);
            bytes = bytes.slice(-10);
            data = handleKeepalive(bytes, data);
        }
        return { data: data };
    } catch (e) {
        throw new Error('Unhandled data');
    }
}

```

### **Payload Encoder Function**

```js
function asNumber(value, fallback) {
  if (value === null || value === undefined || value === "") return fallback;
  if (typeof value === "number") return value;
  var n = Number(value);
  return isNaN(n) ? fallback : n;
}

function asBool(value, fallback) {
  if (value === null || value === undefined || value === "") return fallback;
  if (typeof value === "boolean") return value;
  if (typeof value === "number") return value !== 0;
  if (typeof value === "string") {
    var v = value.trim().toLowerCase();
    if (v === "true" || v === "on" || v === "1" || v === "yes") return true;
    if (v === "false" || v === "off" || v === "0" || v === "no") return false;
  }
  return fallback;
}

function parseMaybeJson(value) {
  if (value && typeof value === "object") return value;
  if (typeof value !== "string") return value;
  try {
    return JSON.parse(value);
  } catch (e) {
    return value;
  }
}

function normalizeCall(portOrInput, maybeInput) {
  var fPort = 1;
  var input = {};
  // CRITICAL: JS passes a 2nd undefined arg on single-arg calls; without the
  // !== undefined guard every UG65-style Encode({fPort,data}) call is treated
  // as legacy and emits an EMPTY downlink (16ASPM root cause, applies to any
  // encoder that skips this guard).
  var legacy = arguments.length >= 2 && maybeInput !== undefined && maybeInput !== null;

  if (legacy) {
    fPort = portOrInput || 1;
    input = maybeInput || {};
  } else {
    input = portOrInput || {};
    fPort = input.fPort || input.port || 1;
  }

  if (!input.hasOwnProperty("data")) {
    input = { data: input };
  }

  return { legacy: legacy, fPort: fPort, data: input.data || {} };
}

// simple 1-byte GET commands (no data byte): key -> opcode
var GET_OPCODES = {
  getDeviceVersions:            0x04,
  getKeepAliveTime:             0x12,
  getChildLock:                 0x14,
  getJoinRetryPeriod:           0x19,
  getUplinkType:                0x1B,
  getWatchDogParams:            0x1D,
  getCo2BoundaryLevels:         0x1F,
  getCo2AutoZeroValue:          0x21,
  getCo2MeasurementPeriod:      0x25,
  getCo2AutoZeroPeriod:         0x2B,
  getUplinkOnButtonPress:       0x2F, // fw>=1.3
  getFullDisplayRefreshPeriod:  0x34,
  getShowTemperature:           0x41,
  getShowHumidity:              0x43,
  getShowLightIntensity:        0x45,
  getCo2MeasuringBlindTime:     0x80, // NOTE: GET opcode 0x80 is LOWER than SET 0x81 -- verified twice against the digest
  getCo2DisplayMode:            0x83,
  getLoRaWANRegion:             0xA4
};

function encodeDownlink(input) {
  var bytes = [];
  var data = (input && input.data) || {};
  var key, i, obj, v;

  for (key in data) {
    if (!data.hasOwnProperty(key)) continue;

    if (GET_OPCODES.hasOwnProperty(key)) {
      bytes.push(GET_OPCODES[key]);
      continue;
    }

    switch (key) {
      case "setKeepAlive": // 0x02, minutes, 0x00 invalid, default 15
        bytes.push(0x02);
        bytes.push(Math.round(asNumber(data[key], 15)) & 0xFF);
        break;

      case "setChildLock": // 0x07, 0=off (default), 1=on
        bytes.push(0x07);
        bytes.push(asBool(data[key], false) ? 1 : 0);
        break;

      case "setJoinRetryPeriod": // 0x10, minutes -> raw*5s, default raw 0x78=120 (10min)
        bytes.push(0x10);
        bytes.push(Math.round((asNumber(data[key], 10) * 60) / 5) & 0xFF);
        break;

      case "setUplinkType": // 0x11, 0=unconfirmed, 1=confirmed (DEFAULT IS 1/CONFIRMED for this device)
        bytes.push(0x11);
        bytes.push(asBool(data[key], true) ? 1 : 0);
        break;

      case "setWatchDogParams": // 0x1C <confirmed uplinks><unconfirmed hours>, defaults 2 / 24
        obj = parseMaybeJson(data[key]) || {};
        bytes.push(0x1C);
        bytes.push(Math.round(asNumber(obj.confirmed, 2)) & 0xFF);
        bytes.push(Math.round(asNumber(obj.unconfirmed, 24)) & 0xFF);
        break;

      case "setCo2BoundaryLevels": // 0x1E <good_medium 16-bit><medium_bad 16-bit> ppm
        obj = parseMaybeJson(data[key]) || {};
        v = Math.round(asNumber(obj.good_medium, 900));
        bytes.push(0x1E);
        bytes.push((v >> 8) & 0xFF);
        bytes.push(v & 0xFF);
        v = Math.round(asNumber(obj.medium_bad, 1500));
        bytes.push((v >> 8) & 0xFF);
        bytes.push(v & 0xFF);
        break;

      case "setCo2AutoZeroValue": // 0x20, 16-bit ppm, default 400
        v = Math.round(asNumber(data[key], 400));
        bytes.push(0x20);
        bytes.push((v >> 8) & 0xFF);
        bytes.push(v & 0xFF);
        break;

      case "setCo2MeasurementPeriod": // 0x24 <good><medium><bad> minutes, defaults 15/15/15
        obj = parseMaybeJson(data[key]) || {};
        bytes.push(0x24);
        bytes.push(Math.round(asNumber(obj.good, 15)) & 0xFF);
        bytes.push(Math.round(asNumber(obj.medium, 15)) & 0xFF);
        bytes.push(Math.round(asNumber(obj.bad, 15)) & 0xFF);
        break;

      case "setCo2AutoZeroPeriod": // 0x2A, hours, 0=disable auto, default 0xC0=192
        bytes.push(0x2A);
        bytes.push(Math.round(asNumber(data[key], 192)) & 0xFF);
        break;

      case "setUplinkOnButtonPress": // 0x2E, fw>=1.3, 0=disable,1=enable, default 1
        bytes.push(0x2E);
        bytes.push(asBool(data[key], true) ? 1 : 0);
        break;

      case "setFullDisplayRefreshPeriod": // 0x33, hours 1-24, default 12
        bytes.push(0x33);
        bytes.push(Math.round(asNumber(data[key], 12)) & 0xFF);
        break;

      case "setDeepSleepMode": // 0x3B, write-only, no GET -- DISRUPTIVE, skip:true in registry
        if (asBool(data[key], false)) {
          bytes.push(0x3B);
          bytes.push(0x01);
        }
        break;

      case "setShowTemperature": // 0x40, 0=hide,1=show, default 1
        bytes.push(0x40);
        bytes.push(asBool(data[key], true) ? 1 : 0);
        break;

      case "setShowHumidity": // 0x42, 0=hide,1=show, default 1
        bytes.push(0x42);
        bytes.push(asBool(data[key], true) ? 1 : 0);
        break;

      case "setShowLightIntensity": // 0x44, 0=hide,1=show, default 1
        bytes.push(0x44);
        bytes.push(asBool(data[key], true) ? 1 : 0);
        break;

      case "setCo2MeasuringBlindTime": // 0x81 (SET opcode -- GET is 0x80, reversed pairing), minutes, default 1
        bytes.push(0x81);
        bytes.push(Math.round(asNumber(data[key], 1)) & 0xFF);
        break;

      case "setCo2DisplayMode": // 0x82, 2-bit flags 0-3, default 3 (both shown)
        bytes.push(0x82);
        bytes.push(Math.round(asNumber(data[key], 3)) & 0x03);
        break;

      case "restartDevice": // 0xA5, fw>=1.2, no data byte -- DISRUPTIVE, skip:true in registry
        if (asBool(data[key], false)) bytes.push(0xA5);
        break;

      case "sendCustomHexCommand":
        var hexStr = String(data[key] || "").replace(/\s+/g, "");
        for (i = 0; i < hexStr.length; i += 2) {
          var b = parseInt(hexStr.substr(i, 2), 16);
          if (!isNaN(b)) bytes.push(b);
        }
        break;

      default:
        break;
    }
  }

  return {
    bytes: bytes,
    fPort: (input && input.fPort) || 1,
    warnings: [],
    errors: []
  };
}

function Encode(portOrInput, maybeInput) {
  var call = normalizeCall(portOrInput, maybeInput);
  var result = encodeDownlink({ fPort: call.fPort, data: call.data });

  // legacy style: Encode(port, input) -> raw bytes
  if (call.legacy) {
    return result.bytes;
  }
  // UG65/UG67 style: Encode(input) -> object
  return result;
}

function Encoder(portOrInput, maybeInput) {
  return Encode(portOrInput, maybeInput);
}

function decodeDownlink(input) {
  return {
    data: { bytes: input.bytes },
    warnings: [],
    errors: []
  };
}

```

### **Object Mapping Function (JSON Function)**

```json
{
    "object": [
        {
            "id": "sensorTemperature",
            "name": "Temperature",
            "value": "",
            "unit": "°C",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "FLOAT",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 62,
            "bacnet_unit_type": "UNITS_DEGREES_CELSIUS"
        },
        {
            "id": "relativeHumidity",
            "name": "Humidity",
            "value": "",
            "unit": "%",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "FLOAT",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 29,
            "bacnet_unit_type": "UNITS_PERCENT_RELATIVE_HUMIDITY"
        },
        {
            "id": "batteryVoltage",
            "name": "Battery",
            "value": "",
            "unit": "V",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "FLOAT",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 5,
            "bacnet_unit_type": "UNITS_VOLTS"
        },
        {
            "id": "CO2",
            "name": "CO2",
            "value": "",
            "unit": "ppm",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 96,
            "bacnet_unit_type": "UNITS_PARTS_PER_MILLION"
        },
        {
            "id": "powerSourceStatus",
            "name": "Power Source",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "ENUM",
            "value_type": "UINT8",
            "bacnet_type": "multistate_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Photovoltaic"
                },
                {
                    "value": 1,
                    "name": "Reserved"
                },
                {
                    "value": 2,
                    "name": "USB"
                }
            ]
        },
        {
            "id": "lux",
            "name": "Light",
            "value": "",
            "unit": "lux",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 37,
            "bacnet_unit_type": "UNITS_LUXES"
        },
        {
            "id": "deviceHardwareVersion",
            "name": "HW Version",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "FLOAT",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "deviceSoftwareVersion",
            "name": "SW Version",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "FLOAT",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "keepAliveTime",
            "name": "KeepAlive",
            "value": "",
            "unit": "min",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "uplinkType",
            "name": "Uplink Type",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "childLock",
            "name": "Child Lock",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "joinRetryPeriod",
            "name": "Join Retry",
            "value": "",
            "unit": "min",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "FLOAT",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "watchDogPeriodConfirmed",
            "name": "WDP-C",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "watchDogPeriodUnconfirmed",
            "name": "WDP-UC",
            "value": "",
            "unit": "h",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 71,
            "bacnet_unit_type": "UNITS_HOURS"
        },
        {
            "id": "co2BoundaryGoodMedium",
            "name": "CO2 Bnd G/M",
            "value": "",
            "unit": "ppm",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 96,
            "bacnet_unit_type": "UNITS_PARTS_PER_MILLION"
        },
        {
            "id": "co2BoundaryMediumBad",
            "name": "CO2 Bnd M/B",
            "value": "",
            "unit": "ppm",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 96,
            "bacnet_unit_type": "UNITS_PARTS_PER_MILLION"
        },
        {
            "id": "co2AutoZeroValue",
            "name": "CO2 AutoZero",
            "value": "",
            "unit": "ppm",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 96,
            "bacnet_unit_type": "UNITS_PARTS_PER_MILLION"
        },
        {
            "id": "co2MeasurementPeriodGood",
            "name": "CO2 Period Good",
            "value": "",
            "unit": "min",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "co2MeasurementPeriodMedium",
            "name": "CO2 Period Medium",
            "value": "",
            "unit": "min",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "co2MeasurementPeriodBad",
            "name": "CO2 Period Bad",
            "value": "",
            "unit": "min",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "co2AutoZeroPeriod",
            "name": "CO2 AZ Period",
            "value": "",
            "unit": "h",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 71,
            "bacnet_unit_type": "UNITS_HOURS"
        },
        {
            "id": "uplinkOnButtonPress",
            "name": "Uplink OnBtn",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "fullDisplayRefreshPeriod",
            "name": "Disp Refresh",
            "value": "",
            "unit": "h",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 71,
            "bacnet_unit_type": "UNITS_HOURS"
        },
        {
            "id": "showTemperature",
            "name": "Temp Visible",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "showHumidity",
            "name": "Humidity Visible",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "showLightIntensity",
            "name": "Light Visible",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "co2MeasuringBlindTime",
            "name": "CO2 Blind Time",
            "value": "",
            "unit": "min",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "co2DisplayMode",
            "name": "CO2 Disp Mode",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "lorawanRegion",
            "name": "LoRaWAN Region",
            "value": "",
            "unit": "",
            "access_mode": "R",
            "data_type": "ENUM",
            "value_type": "UINT8",
            "bacnet_type": "multistate_input_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "EU868"
                },
                {
                    "value": 1,
                    "name": "AS923"
                },
                {
                    "value": 2,
                    "name": "AU915"
                },
                {
                    "value": 3,
                    "name": "US915"
                }
            ]
        },
        {
            "id": "setKeepAlive",
            "name": "Set KeepAlv",
            "value": "",
            "unit": "min",
            "access_mode": "W",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_output_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "setJoinRetryPeriod",
            "name": "Set JoinRt",
            "value": "",
            "unit": "min",
            "access_mode": "W",
            "data_type": "NUMBER",
            "value_type": "FLOAT",
            "bacnet_type": "analog_output_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "setCo2AutoZeroValue",
            "name": "Set AutoZero",
            "value": "",
            "unit": "ppm",
            "access_mode": "W",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_output_object",
            "bacnet_unit_type_id": 96,
            "bacnet_unit_type": "UNITS_PARTS_PER_MILLION"
        },
        {
            "id": "setCo2AutoZeroPeriod",
            "name": "Set AZ Period",
            "value": "",
            "unit": "h",
            "access_mode": "W",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_output_object",
            "bacnet_unit_type_id": 71,
            "bacnet_unit_type": "UNITS_HOURS"
        },
        {
            "id": "setFullDisplayRefreshPeriod",
            "name": "Set DispRefr",
            "value": "",
            "unit": "h",
            "access_mode": "W",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_output_object",
            "bacnet_unit_type_id": 71,
            "bacnet_unit_type": "UNITS_HOURS"
        },
        {
            "id": "setCo2MeasuringBlindTime",
            "name": "Set BlindTime",
            "value": "",
            "unit": "min",
            "access_mode": "W",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_output_object",
            "bacnet_unit_type_id": 72,
            "bacnet_unit_type": "UNITS_MINUTES"
        },
        {
            "id": "setCo2DisplayMode",
            "name": "Set DispMode",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "NUMBER",
            "value_type": "UINT8",
            "bacnet_type": "analog_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS"
        },
        {
            "id": "setUplinkType",
            "name": "Set Uplink",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Unconfirmed"
                },
                {
                    "value": 1,
                    "name": "Confirmed"
                }
            ]
        },
        {
            "id": "setChildLock",
            "name": "Set ChildLock",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Off"
                },
                {
                    "value": 1,
                    "name": "On"
                }
            ]
        },
        {
            "id": "setUplinkOnButtonPress",
            "name": "Set OnBtnUp",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Disabled"
                },
                {
                    "value": 1,
                    "name": "Enabled"
                }
            ]
        },
        {
            "id": "setShowTemperature",
            "name": "Set T Visible",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Hide"
                },
                {
                    "value": 1,
                    "name": "Show"
                }
            ]
        },
        {
            "id": "setShowHumidity",
            "name": "Set RH Visible",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Hide"
                },
                {
                    "value": 1,
                    "name": "Show"
                }
            ]
        },
        {
            "id": "setShowLightIntensity",
            "name": "Set Lux Visible",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Hide"
                },
                {
                    "value": 1,
                    "name": "Show"
                }
            ]
        },
        {
            "id": "setDeepSleepMode",
            "name": "Set DeepSleep",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Sleep"
                }
            ]
        },
        {
            "id": "restartDevice",
            "name": "Restart Dev",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "setWatchDogParams",
            "name": "Set WD Pms",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "TEXT",
            "value_type": "STRING",
            "bacnet_type": "character_string_value_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "max_length": 128
        },
        {
            "id": "setCo2BoundaryLevels",
            "name": "Set CO2 Bnds",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "TEXT",
            "value_type": "STRING",
            "bacnet_type": "character_string_value_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "max_length": 128
        },
        {
            "id": "setCo2MeasurementPeriod",
            "name": "Set CO2 Period",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "TEXT",
            "value_type": "STRING",
            "bacnet_type": "character_string_value_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "max_length": 128
        },
        {
            "id": "sendCustomHexCommand",
            "name": "Send HexCmd",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "TEXT",
            "value_type": "STRING",
            "bacnet_type": "character_string_value_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "max_length": 242
        },
        {
            "id": "getDeviceVersions",
            "name": "Get DevVers",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getKeepAliveTime",
            "name": "Get KeepAlv",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getChildLock",
            "name": "Get ChildLock",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getJoinRetryPeriod",
            "name": "Get JoinRt",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getUplinkType",
            "name": "Get Uplink",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getWatchDogParams",
            "name": "Get WD Pms",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getCo2BoundaryLevels",
            "name": "Get CO2 Bnds",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getCo2AutoZeroValue",
            "name": "Get AutoZero",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getCo2MeasurementPeriod",
            "name": "Get CO2 Period",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getCo2AutoZeroPeriod",
            "name": "Get AZ Period",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getUplinkOnButtonPress",
            "name": "Get OnBtnUp",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getFullDisplayRefreshPeriod",
            "name": "Get DispRefr",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getShowTemperature",
            "name": "Get T Visible",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getShowHumidity",
            "name": "Get RH Visible",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getShowLightIntensity",
            "name": "Get Lux Visible",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getCo2MeasuringBlindTime",
            "name": "Get BlindTime",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getCo2DisplayMode",
            "name": "Get DispMode",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        },
        {
            "id": "getLoRaWANRegion",
            "name": "Get Region",
            "value": "",
            "unit": "",
            "access_mode": "W",
            "data_type": "BOOL",
            "value_type": "UINT8",
            "bacnet_type": "binary_output_object",
            "bacnet_unit_type_id": 95,
            "bacnet_unit_type": "UNITS_NO_UNITS",
            "values": [
                {
                    "value": 0,
                    "name": "Idle"
                },
                {
                    "value": 1,
                    "name": "Run"
                }
            ]
        }
    ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mclimate.eu/mclimate-lorawan-devices/devices/mclimate-co2-display-lite/decoding-and-bacnet-object-mapping/bacnet-codec-and-definition-files/milesight.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
