RAK 7201 codec failing Chirpstack V4

I have a couple of RAK 7201 button pads communicating fine through chirpstack, but the codec is throwing errors. Ive used both the TTN codec as provided through the GUI, and a couple of alternate codecs found on the web.

The TTN codec is as follows:

function Decoder(bytes, port,)
{
var decoded = {};

// Subtract 64 to show actual button number pressed
// Default firmware sends A,B,C and D
decoded.button_pressed = bytes - 64;

return decoded;

}

But on uplink I get the error:

"Exception generated by quickjs: ‘decodeUplink’ is not defined at (eval_script:15) "

No doubt a rookie error here…any suggestions how to fix?

[I can see the base-64 raw data payload in node-red, it does indeed convert to A, B, C, D in ASCII (which is actually workable…question is why can’t i successfully decode with the codec?)

OK, so obviously a V3 to V4 codec problem, solved thanks to the ‘compatibility wrapper’ as explained here [Uplink Decoder "bytes" undefined - #5 by le_on].

There are loads of slightly incorrect versions of this on the forum.

Things change over time. In ChirpStack v4 the encoder / decoder function signatures have changed, to provide compatibility with the LoRa Alliance Payload Codec API. Please see also the ChirpStack documentation:

https://www.chirpstack.io/docs/chirpstack/use/device-profiles.html#custom-javascript-codec-functions

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.