Skip to content

Instantly share code, notes, and snippets.

@PaulGoldschmidt
Created October 1, 2024 09:13
Show Gist options
  • Select an option

  • Save PaulGoldschmidt/245186b30af25ec4ab6daa7eb86f415f to your computer and use it in GitHub Desktop.

Select an option

Save PaulGoldschmidt/245186b30af25ec4ab6daa7eb86f415f to your computer and use it in GitHub Desktop.

Revisions

  1. PaulGoldschmidt created this gist Oct 1, 2024.
    15 changes: 15 additions & 0 deletions buergerportal-sampledecoder.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    function decodeUplink(input) {
    var temp = input.bytes[0] << 24 | input.bytes[1] << 16 | input.bytes[2] << 8 | input.bytes[3];
    var hum = input.bytes[4] << 24 | input.bytes[5] << 16 | input.bytes[6] << 8 | input.bytes[7];
    var pressure = input.bytes[8] << 24 | input.bytes[9] << 16 | input.bytes[10] << 8 | input.bytes[11];
    var gas = input.bytes[12] << 24 | input.bytes[13] << 16 | input.bytes[14] << 8 | input.bytes[15];

    return {
    data: {
    temperature: temp / 100,
    humidity: hum / 1000,
    pressure: pressure / 100,
    gasResistance: gas / 1000
    }
    };
    }