// Check if msg exists and has the required propertiesif (msg &&msg.data !==undefined&&msg.port ===85) {var data =msg.data;// Extracting bytes from the datavar bytes = [];for (var i =0; i <data.length; i +=2) {bytes.push(parseInt(data.substr(i,2),16)); }var decoded = {};// Iterate over the bytes to decode each channelfor (var i =0; i <bytes.length; ) {var channelId = bytes[i++];var channelType = bytes[i++];// BATTERYif (channelId ===0x01&& channelType ===0x75) {decoded.battery = bytes[i++]; }// TEMPERATUREelseif (channelId ===0x03&& channelType ===0x67) {decoded.temperature =readInt16LE(bytes.slice(i, i +2)) /10; // Convert to Celsius i +=2; }// HUMIDITYelseif (channelId ===0x04&& channelType ===0x68) {decoded.humidity = bytes[i++] /2; // Convert to % }// Add other channel types as neededelse {// If unknown channel type, move to the next channel i++; } }return { msg: { battery:decoded.battery !==undefined?decoded.battery :null, temperature:decoded.temperature !==undefined?decoded.temperature :null, humidity:decoded.humidity !==undefined?decoded.humidity :null, ts:msg.ts, data:msg.data, rssi:msg.rssi }, metadata: {}, msgType:'POST_TELEMETRY_REQUEST' };}// Return null if required properties are not presentreturnnull;// Function to read 16-bit signed little-endian integer from bytesfunctionreadInt16LE(bytes) {var value = bytes[1] <<8| bytes[0];return (value &0x8000) ? value |0xFFFF0000: value;}