JS codec - Where do "variables" come from

Hi Folks,

All of the examples I can find of a JS codec show how to use the fPort and bytes parameters (which I can process fine) - but the template in the UI has a 3rd “variables” parameter that I can’t find any info on in the docs, and I’m struggling to make sense of the comment. I always get a null value here - so what has to be set where to get data in this parameter ?

// 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]
//  - variables contains the device variables e.g. {"calibration": "3.5"} (both the key / value are of type string)
// The function must return an object, e.g. {"temperature": 22.5}
function Decode(fPort, bytes, variables) {
  return {};

variables comes from device configuration field

1 Like

Thanks - got it. Not sure how I missed that :wink: