Decode Your Payload function Decoder(bytes, port) { var decoded = {}; var co2Int = (bytes[0] << 8) | bytes[1]; // CO2 is a single byte var cInt = (bytes[2] << 8) | bytes[3]; // temperature ºC is 2 bytes var rem =(bytes[4] << 8) | bytes[5]; // humidity % is 2 bytes var pre = (bytes[6]) + ((bytes[7]) << 8) + ((bytes[8]) << 16) + ((bytes[9]) << 24) ; // pressure is a 4-byte value var alt = (bytes[10]) + ((bytes[11] << 8)) +(bytes[12] << 16) + (bytes[13] << 24); // Altitude is 4 bytes // Decode integer to float decoded.co2 = co2Int; decoded.temp_c = cInt / 100; decoded.humidity = rem / 100; decoded.pressure = pre / 100; decoded.altitude = alt / 100; }
return decoded;
@davidgsIoT