function Decoder(b, port) { // LSB, Least Significant Bit/Byte first! Your node likely sends MSB instead. // Sign-extend the 3rd and 6th bytes into a 4th and 8th byte: var lat = (b[0] | b[1]<<8 | b[2]<<16 | (b[2] & 0x80 ? 0xFF<<24 : 0)) / 10000; var lng = (b[3] | b[4]<<8 | b[5]<<16 | (b[5] & 0x80 ? 0xFF<<24 : 0)) / 10000; return { location: { lat: lat, lng: lng }, love: "TTN payload functions" }; }