Hi
I have the following data: 0x050dfa3a35cdfcfff8ffdc0418b2f690409acb6d253547af
I’d like to decode this to get human readable telemetry. I was using the following decoder:
function Decoder(bytes) {
var decoded = {}
var temperature = (bytes[1] << 8) | bytes[2];
var humidity = (bytes[3] << 8) | bytes[4];
var battery = (bytes[5] << 8) | bytes[6];
var pressure = (bytes[7] << 8) | bytes[8];
decoded.temperature = parseFloat((temperature * 0.005).toFixed(2));
decoded.humidity = parseFloat((humidity * 0.0025).toFixed(2));
decoded.battery = parseFloat((battery).toFixed(2)) / 1000.0;
decoded.pressure = parseFloat((pressure).toFixed(2));
var fields = []
for (var key in decoded) {
if (decoded.hasOwnProperty(key)) {
fields.push({field: key.toUpperCase(), value: decoded[key]})
}
}
return fields;
}
I have the following output:
[{“field”:“TEMPERATURE”,“value”:6.4},{“field”:“HUMIDITY”,“value”:0},{“field”:“BATTERY”,“value”:0.003},{“field”:“PRESSURE”,“value”:3}]
This is not the right telemetry. No idea what is wrong, I already tried other javascript decoders I found on the Internet, but I’m not succeeding. Anyone has an idea how to decode this payload?
Thanks!