Downlink helpers
These javascript samples can help compute valid downlinks for Elsys ERS and Sensit 3.0.
Note, the Elsys code requires to be run in node.js due to useing Buffers.
Elsys (LORAWAN)
// raw: 3E0A14000000461700000002 from https://www.elsys.se/en/downlink-generator/
let raw = "3E0A14000000461700000002";
let asd = "3E051400000045";
// Convert hex to base64 bytes
var base64String = Buffer.from(raw, "hex").toString("base64");
console.log(base64String); // PgoUAAAAQRcAAAAD
/*
Procedure:
1. Scan Elsys med app for at få info
2. Lav ønsket payload
3. Insæt: confirmed, port 6 (eller andet hvis konfigureret til det i elsys app)
4. enqueue downlink
5. vent på at den modtager downlink og confirmer (den vil joine igen)
*/
Sensit 3.0 (SigFox)
// Byte 0: 00 0 0 0 0 0 0
let b0 = 0x0;
// Byte 1: 00 01 1110
let b1 = 0x1e;
// Byte 2: 00 01 1001
let b2 = 0x19;
// Byte 3: 0000 0010
let b3 = 0x02;
// Byte 4: 0 0000010
let b4 = 0x80 | 0x0f;
// Byte 5
let b5 = 0x10;
// Byte 6
let b6 = 0x10 | 0x02;
let b7 = 0x70 | 0x2;
let res = [b0, b1, b2, b3, b4, b5, b6, b7];
console.log(res.map(x => x.toString(16).padStart(2, "0")).join(""));