# Help to decode Netvox R711 data

**URL:** <https://www.thethingsnetwork.org/forum/t/help-to-decode-netvox-r711-data/23200>\
**Category:** End Devices (Nodes)\
**Created:** [February 25, 2019, 11:03am UTC](https://www.thethingsnetwork.org/forum/t/help-to-decode-netvox-r711-data/23200 "2019-02-25T11:03:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [February 25, 2019, 11:47am UTC](https://www.thethingsnetwork.org/forum/t/help-to-decode-netvox-r711-data/23200/4 "2019-02-25T11:47:39Z")

</div>

Almost perfect. 🙂

The `bytes` array is zero-indexed, so the first byte has index 0. So all indexes are 1 too high; 4 for the battery should read 3, and so on.

Temperatures are signed values, which need 4 bytes in JavaScript; see [Negative Temperature](https://www.thethingsnetwork.org/forum/t/negative-temperature/21330). So:

```javascript
// Sign-extend to 32 bits to support negative values, by shifting 24 bits
// (16 too far) to the left, followed by a sign-propagating right shift:
var Temperature = (bytes[4]<<24>>16 | bytes[5]) / 100;

```

You’re right about decoding the unsigned humidity, but I really doubt the sensor is really that accurate. But it confirms to the documentation.

Finally, one might want to take the first 3 bytes into account as well for other uplink types. Or, lacking any details about that, fail when they don’t match:

```javascript
if (bytes[0] === 0x01 && bytes[1] === 0x01 && bytes[2] === 0x01) {
  // decode as shown in earlier post
  return {
    ...
  };
}
// Maybe one could also return null, or throw an error, to make TTN fail
return {
  error: "unsupported version, device type or report type"
};

```

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/help-to-decode-netvox-r711-data/23200)._
