Hi everybody,
I’m new to TTN and got stuck. I started this new topic, because I could get any further with the old post, they are about v2 TTN and in v3 TTN everyhing seems to be different.
I have added an application, and then added the Dragino LGT92. The systems seem to talk to each other, but i don’t recieve the battery, postition etc. I always see in the examples. Also it says: " Last seen info unavailable", while there just been activity in the messages.
For example if I look in the messages I see this:
11:20:46
Successfully processed join-request
JoinEUI
A000000BLASECRET
DevEUI
A840BLABLASECRET
Bandwidth
125000
SNR
-17.5
RSSI
-111
Raw payload
0002010000000000A0FDFA82A1914140A8499091538CAD
I think this payload needs to be decoded and then I can see the values maybe???
So I tried this v2 script in the Payload Formatters > Downlink. There the config says “This option will affect both uplink and downlink formatter” and the example shows an encoder an decoder. But I don’t have that encoder script, only this decoder script. Is this oke to put in? I tried and no effect. And is this script Java? Do I need to use the “Java Script playload decoder? or is this another kind of script?” Sorry i’m really new to this. The script I found in the forums is this:
function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var alarm = bytes[6] & 0x40 ? true : false; //Alarm status
value = ((bytes[6] & 0x3f) << 8) | bytes[7];
var batV = value / 1000; //Battery,units:Volts
value = (bytes[8] << 8) | bytes[9];
if (bytes[8] & 0x80) {
value |= 0xffff0000;
}
var roll = value / 100; //roll,units: °
value = (bytes[10] << 8) | bytes[11];
if (bytes[10] & 0x80) {
value |= 0xffff0000;
}
var pitch = value / 100; //pitch,units: °
var json = {
roll: roll,
pitch: pitch,
batV: batV,
alarm: alarm,
};
var value = (bytes[0] << 16) | (bytes[1] << 8) | bytes[2];
if (bytes[0] & 0x80) {
value |= 0xffffff000000;
}
var value2 = (bytes[3] << 16) | (bytes[4] << 8) | bytes[5];
if (bytes[3] & 0x80) {
}
value2 |= 0xffffff000000;
if (value == 0x0fffff && value2 == 0x0fffff) {
//gps disabled (low battery)
} else if (value === 0 && value2 === 0) {
//gps no position yet
} else {
}
json.latitude = value / 10000; //gps latitude,units: °
json.longitude = value2 / 10000; //gps longitude,units: °
return json;
}
Last but not least when I added the Dragino LGT92 with this pre-filled-in config of the V3…it asked which “Hardware version” and " Firmware version" I have, so I have selected “unknown_hw_version” and “1.6.4” Firmware…hoping I have the last version because I bought it last week… does this really, matter? Should I delete everyhing, start over and try and older firmware version? Or can you add device multiple times to TTN an try which one works??
Anyone has a clue how I can know for shure which firmware I have? It’s not on the box. Also emailed this question to Dragino…I hope they know what firmware version they shipped.
If I get this working. My goal is to transfer the tracking data to Home Assistant.The Things Network - Home Assistant
But first I have to get these basic things right in TTN.