From 88e52f18b59e59174a32ed1d3920a06493e5501e Mon Sep 17 00:00:00 2001 From: Stephan Martin Date: Mon, 11 Mar 2024 20:26:40 +0100 Subject: [PATCH] Update unified_decoder.js to work also with ChirpStack V4 ChirpStack V4 needs decodeUplink, this wraps the Decoder with it --- console-decoders/unified_decoder.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/console-decoders/unified_decoder.js b/console-decoders/unified_decoder.js index e7849d2..b025b28 100644 --- a/console-decoders/unified_decoder.js +++ b/console-decoders/unified_decoder.js @@ -5,6 +5,7 @@ // Accuracy is a dummy value required by some Integrations. // Battery is 1/100 of a volt, offset by 2v for a range of 2.00 to 4.56 volts. // + function Decoder(bytes, port) { var decoded = {}; @@ -60,4 +61,11 @@ function Decoder(bytes, port) { } return decoded; -} \ No newline at end of file +} + +// Wrapper for ChirpStack V4: +function decodeUplink(input) { + return { + data: Decoder(input.bytes, input.fPort) + }; +}