# Unable to get data in right format for AcSIP S76SXB

**URL:** <https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988>\
**Category:** End Devices (Nodes)\
**Created:** [November 21, 2018, 7:57pm UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988 "2018-11-21T19:57:58Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![madhuvarsha](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/madhuvarsha/32/16806_2.png) [@madhuvarsha](https://www.thethingsnetwork.org/forum/u/madhuvarsha)\
**Post date:** [November 21, 2018, 7:57pm UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/1 "2018-11-21T19:57:59Z")

</div>

Please see the data… I m using AcSIP S76SXB -Nothing in Field .So it is not usable for TTN Mapper and Cayenne Dashboard.

![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/3/b/3b7d436d0441e32a8a165b9ef8ca865d16ecd3c0.png)

---

<div class="post-metadata">

**Author:** ![UdLoRa](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/udlora/32/45330_2.png) [@UdLoRa](https://www.thethingsnetwork.org/forum/u/UdLoRa)\
**Post date:** [November 22, 2018, 7:53am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/2 "2018-11-22T07:53:07Z")

</div>

Payload is there. Did you add a decoder it in the Applications/Payload Formats section?

---

<div class="post-metadata">

**Author:** ![madhuvarsha](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/madhuvarsha/32/16806_2.png) [@madhuvarsha](https://www.thethingsnetwork.org/forum/u/madhuvarsha)\
**Post date:** [November 22, 2018, 10:16am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/4 "2018-11-22T10:16:40Z")

</div>

> [@UdLoRa](#):
>
> decoder it in the Applications/Payload Formats section?

I tried this one to fetch the Long, lat for TTN mapper, but no success:

```auto
function Decoder(bytes, port) {
        // Decode an uplink message from a buffer
        // (array) of bytes to an object of fields.
        var decoded = {};

        decoded.latitude = ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];
        decoded.latitude = (decoded.latitude / 16777215.0 * 180) - 90;
      
        decoded.longitude = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
        decoded.longitude = (decoded.longitude / 16777215.0 * 360) - 180;
      
        var altValue = ((bytes[6]<<8)>>>0) + bytes[7];
        var sign = bytes[6] & (1 << 7);
        if(sign)
        {
            decoded.altitude = 0xFFFF0000 | altValue;
        }
        else
        {
            decoded.altitude = altValue;
        }
      
        decoded.hdop = bytes[8] / 10.0;

        return decoded;
    }

```

---

<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:** [November 22, 2018, 11:36am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/5 "2018-11-22T11:36:31Z")

</div>

On which port is the uplink received? (You should not use port 0.)

Where did you find that decoder? **What payload do you use to test it while editing in TTN Console?** Does testing it get you the expected output?

The 8 bytes payload `AC0600FF018D0260` from your screenshot is too short for your decoder. ~~Using 7 rather than 8 in `decoded.hdop = bytes[7] / 10.0;` might fix that,~~ With a length of 8 there is no `bytes[8]`, and all 8 bytes from `bytes[0]` through `bytes[7]` were already used for other fields. Not knowing how the data is encoded, fixing it would just be a wild guess.

> [@madhuvarsha](#):
>
> ```javascript
> (bytes[0]<<16)>>>0
> 
> ```

Why are you using the `>>>0` here? I think it has no effect.

> [@madhuvarsha](#):
>
> Nothing in Field .So it is not usable for TTN Mapper and Cayenne Dashboard.

Note that even when the fields show in the output, you will not be able to use TTN Console’s Payload Formats to create some Cayenne-compatible payload. To use Cayenne, the device must use the LPP format. If the device does not use Cayenne LPP, then you cannot use TTN Console’s Payload Formats to convert the payload into that format:

> [@Convert custom payload to lpp payload in TTN console](https://www.thethingsnetwork.org/forum/t/convert-custom-payload-to-lpp-payload-in-ttn-console/12171/18):
>
> In V2 we don’t allow altering `payload_raw` . It will, technically, be supported in V3 but not sure if it will be GA in the public Consoles

---

<div class="post-metadata">

**Author:** ![madhuvarsha](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/madhuvarsha/32/16806_2.png) [@madhuvarsha](https://www.thethingsnetwork.org/forum/u/madhuvarsha)\
**Post date:** [November 22, 2018, 12:18pm UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/6 "2018-11-22T12:18:17Z")

</div>

As per AcSIP S76S doc…the data structure is as follows:  
 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/d/8/d8ad837481cec04256f5c85ceee7cd2a2bb7cb69.png)

---

<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:** [November 22, 2018, 12:34pm UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/7 "2018-11-22T12:34:20Z")

</div>

Sorry, I don’t see any reference to coordinates there, and it surely does not match your decoder function. Like the 1st byte (being `byte[0]` in the JavaScript decoder function) has a fixed value, and the 4th byte (being `byte[3]`) is marked as “reserved for future use”, while your decoder is using both.

So, I recommend you take a look at my other questions.

The format you show could possibly be decoded using:

```javascript
function Decoder(bytes, port) {
  var header = bytes[0];
  if (header !== 0xAC) {
    return {
      error: 'Unsupported payload header'
    };
  }
  var len = bytes[1];
  if (len !== 6) {
    return {
      error: 'Unsupported payload length'
    };
  }
  var gpio0 = bytes[2] & 0x0F;
  var gpio1 = bytes[2] >> 4;
  var rfu = bytes[3];
  // Documented as 12 bits; assuming MSB and not supporting negative values
  var adc0 = bytes[4]<<8 | bytes[5];
  var adc1 = bytes[6]<<8 | bytes[7];
  return {
    gpio0: gpio0,
    gpio1: gpio1,
    adc0: adc0,
    adc1: adc1
  }
}

```

(Please, don’t post screenshots for terminal output.)

---

<div class="post-metadata">

**Author:** ![madhuvarsha](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/madhuvarsha/32/16806_2.png) [@madhuvarsha](https://www.thethingsnetwork.org/forum/u/madhuvarsha)\
**Post date:** [November 22, 2018, 3:21pm UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/8 "2018-11-22T15:21:36Z")

</div>

> [@arjanvanb](#):
>
> AC0600FF018D0260

For payload AC0600FF018D0260 it shows following outcome

{  
“adc0”: 397,  
“adc1”: 608,  
“gpio0”: 0,  
“gpio1”: 0  
}

---

<div class="post-metadata">

**Author:** ![madhuvarsha](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/madhuvarsha/32/16806_2.png) [@madhuvarsha](https://www.thethingsnetwork.org/forum/u/madhuvarsha)\
**Post date:** [November 22, 2018, 3:24pm UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/9 "2018-11-22T15:24:21Z")

</div>

> [@madhuvarsha](#):
>
> AC0600FF018D0260

 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/4/f/4f2dfad1f683d6c5c7ac886f47e494096aa79998.png)

---

<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:** [November 22, 2018, 5:16pm UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/10 "2018-11-22T17:16:16Z")

</div>

> [@arjanvanb](#):
>
> Where did you find that decoder?

To answer my own question: you used a decoder that [you found in a topic about a different device](https://www.thethingsnetwork.org/forum/t/ttn-mapper-and-no-data-appearing/15474/6), the TTGO T-Beam.

> [@madhuvarsha](#):
>
> For payload AC0600FF018D0260 it shows following outcome

True, and very much as expected. And, you’ll get the very same result when using that payload to test the decoder function:

![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/c/d/cda9a5f03e6d8ee7084bb95b0a025c4b2409ad78.png)

If you still have a question then please be more specific. Note that you can also TTN Mapper with a device that does not have a GPS module, [if you use its mobile app to determine the coordinates](http://ttnmapper.org/faq.php).

---

<div class="post-metadata">

**Author:** ![madhuvarsha](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/madhuvarsha/32/16806_2.png) [@madhuvarsha](https://www.thethingsnetwork.org/forum/u/madhuvarsha)\
**Post date:** [November 26, 2018, 6:42am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/11 "2018-11-26T06:42:47Z")

</div>

Thanks for support. Since I can see the RSSI, SNR and Location in Payload, I want to extract the same also and want to integrate the data with Cayenne Dashboard !!

---

<div class="post-metadata">

**Author:** ![UdLoRa](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/udlora/32/45330_2.png) [@UdLoRa](https://www.thethingsnetwork.org/forum/u/UdLoRa)\
**Post date:** [November 26, 2018, 8:08am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/12 "2018-11-26T08:08:47Z")

</div>

If the payload structure is the one you mentioned above, there is no location. The location you see is the gateway location.  
EDIT: and since the gateway will be fixed in some place, there is no need to track it 😉

---

<div class="post-metadata">

**Author:** ![madhuvarsha](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/madhuvarsha/32/16806_2.png) [@madhuvarsha](https://www.thethingsnetwork.org/forum/u/madhuvarsha)\
**Post date:** [November 27, 2018, 9:04am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/13 "2018-11-27T09:04:12Z")

</div>

This is node data capturing RSSI, SNR and location:  
 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/3/b/3b7d436d0441e32a8a165b9ef8ca865d16ecd3c0.png)

Right now Node is next to Gateway so it will show almost same coordinates.

---

<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:** [November 27, 2018, 10:24am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/14 "2018-11-27T10:24:50Z")

</div>

> [@madhuvarsha](#):
>
> As per AcSIP S76S doc…the data structure is as follows:

Like explained above, given that structure, there is no location data in your node’s payload. Does it even have a GPS module? And the metadata of the gateway(s) is not giving you your node’s location either.

Posting the same image again is not helping. Instead: what is your exact question? What are you trying to show with the above screenshot?

---

<div class="post-metadata">

**Author:** ![UdLoRa](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/udlora/32/45330_2.png) [@UdLoRa](https://www.thethingsnetwork.org/forum/u/UdLoRa)\
**Post date:** [November 27, 2018, 10:32am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/15 "2018-11-27T10:32:32Z")

</div>

> [@madhuvarsha](#):
>
> This is node data capturing RSSI, SNR and location:

No: this is **gateway** data capturing RSSI, SNR of the received packet and **its own** location. Node does not know about RSSI and SNR (and in your case, about location too).

---

<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:** [November 27, 2018, 10:42am UTC](https://www.thethingsnetwork.org/forum/t/unable-to-get-data-in-right-format-for-acsip-s76sxb/19988/16 "2018-11-27T10:42:22Z")

</div>

And even more: if your node’s transmission is received by multiple gateways, you’ll get coordinates of multiple gateways as well. And those could be many kilometers apart.

(You might think you can then calculate the node’s position, but: no. See [Location by triangulation](https://www.thethingsnetwork.org/forum/t/location-by-triangulation/435) for that.)

If you want to access the gateway(s) metadata in a payload format Decoder function: that is not possible. You’ll only get those details using some integration, or by using the MQTT data API.
