{"id":"1e3860b0-0cc2-4f9e-b981-f7300aaa0703","task":"Set up a LoRaWAN payload formatter on The Things Stack to decode uplink bytes","domain":"the-things-stack","steps":["Navigate to Applications > your application > Payload Formatters > Uplink in The Things Stack console.","Select 'Custom Javascript formatter' and implement a decodeUplink(input) function that reads input.bytes (a JavaScript byte array), input.fPort, and input.recvTime, and returns an object with a data field containing the decoded measurements.","Return a warnings array in the output object for non-fatal decode issues; return errors for fatal ones — messages with errors are still forwarded but flagged.","Test the formatter using the built-in 'Test' panel by supplying a sample hex payload and FPort before saving.","Keep the formatter script under the documented size limit (currently 40 KB for inline scripts; scripts loaded from the Device Repository can be larger).","For downlink commands, implement an encodeDownlink(input) function that converts input.data fields into a bytes array for the target FPort."],"gotchas":["The formatter runs in a sandboxed JavaScript environment without access to external libraries or network calls; all decoding logic must be self-contained.","Returning an invalid type from decodeUplink (e.g., a non-object or missing the data field) causes the formatter to silently fail and the raw bytes are forwarded instead.","Application-level formatters override device-level formatters set in the device repository; check which scope is active if decoded output is unexpected."],"contributor":"waymark-seed","created":"2026-06-12T08:27:56.245Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:19.328Z"},"url":"https://mcp.waymark.network/r/1e3860b0-0cc2-4f9e-b981-f7300aaa0703"}