I’m trying to get the right encoder and decoder to comunicate with this device: inteliLIGHT® NEMA street lighting controller
I already got the abp working. Now i need to send a payload: 4207 and i expect to receive a 820007ee as a response… where i need to get the ‘ee’ hexa value translated to decimal value.
I appreciate any kind of guide to develop this codec. The device doesnt seem to be receiving my ‘4207’ payload…
as for codec to decode, here is an example that I got from somewhere else. It should give you a jumping off point, hopefully.
// Decode decodes an array of bytes into an object.
// - fPort contains the LoRaWAN fPort number
// - bytes is an array of bytes, e.g. [225, 230, 255, 0]
// The function must return an object, e.g. {“temperature”: 22.5}
function bin2String(array) {
return String.fromCharCode.apply(String, array);
}
function bin2HexStr(arr)
{
var str = “”;
for(var i=0; i<arr.length; i++)
{
var tmp = arr[i].toString(16);
if(tmp.length == 1)
{
tmp = "0" + tmp;
}
tmp = "0x" + tmp;
if (i != arr.length - 1) {
tmp += ",";
}
str += tmp;
}
return str;
}
function Decode(fPort, bytes)
{
var myObj = {“DecodeDataString”:“”, “DecodeDataHex”:“”};
var tostring=bin2String(bytes);
var tosHextring=bin2HexStr(bytes);
myObj.DecodeDataString = tostring;
myObj.DecodeDataHex = tosHextring;
return myObj;
}
If the device doesn’t seem to be receiving the msg – when you view the device on the application tab of the chiprstack server gui do you ‘txack’ ? I believe this will only show up if it is received by the device (and you might see errors if there are any).
Also - just searching around for similar things I found this: https://github.com/ElectronicCats/CayenneLPP
I have not tried it yet, but it does look like chirpstack natively supports it. Not sure about that node you’re talking about, though.