Dragino LGT-92 Decoder Help?

Hi all,
I have tried porting the supplied decoder (intended for the things network) and using it in my device profile for the LGT-92 in chirpstack but I am having no success.

Decoder link from Dragino is here
https://www.dragino.com/downloads/index.php?dir=LGT_92/Decoder/

Does anyone have any experience with this end-node or have a decoder I could take a look at please?

I am planning on using it with thingsboard (integration in chirpstack). I have used other end-nodes with thingsboard so I am familiar with the config using the token, etc.

Any help would be greatly appreciated.

EDIT: When I attempt this, I only get 0’s for each of the variables in the decoder sent to thingsboard.

EDIT #2: Apparently decoder versions depend on firmware version. I will update firmware tomorrow and retest with matching decoder and post results.

Thank you,

Dan

The secret is in the name… :slight_smile:

image

so use this:

function Decode(fPort, bytes){
var data = {  
    Latitude: 
      (bytes[0]<<24 | bytes[1]<<16 | bytes[2]<<8 | bytes[3]) / 1000000,
	  
    Longitude:
      (bytes[4]<<24 | bytes[5]<<16 | bytes[6]<<8 | bytes[7]) / 1000000,


    // Alarm status: boolean
    ALARM_status: (bytes[8] & 0x40) > 0,

    // Battery; 14 bits; unit: V
    BatV: ((bytes[8] & 0x3f)<<8 | bytes[9]) / 1000,

    // Motion detection mode; 2 bits
    MD: {
      "0": "Disable",
      "1": "Move",
      "2": "Collide",
      "3": "Custom"
    }[bytes[10]>>6],

    // LED status for position, uplink and downlink; 1 bit
    LON: (bytes[10] & 0x20) ? "ON" : "OFF",

    // Firmware version; 5 bits 
    FW:150+(bytes[10] & 0x1f),

    // Roll; signed 16 bits integer, MSB; unit: 

    // Sign-extend to 32 bits to support negative values: shift 16 bytes

    // too far to the left, followed by sign-propagating right shift

    Roll: (bytes[11]<<24>>16 | bytes[12]) / 100,

    // Pitch: signed 16 bits integer, MSB, unit: 

    Pitch: (bytes[13]<<24>>16 | bytes[14]) / 100,  
  };
	return data;
}
1 Like

yep, worked that out today.

Consider this one solved. Thank you!

not sure if you have had a chance to have a play around with v4, but there is a function therein where you can import tons and tons of decoders… well worth the migration if you intend to start using loads of different devices…

1 Like

Oh wow, thats excellent, I have deployed v4 yet, but I am definitely going to now. Thankyou for the heads up, greatly appreciated.