Add new Device to repository / Decode Help

Add new Device to repository / Decode Help

Hi All,

Hopefully someone can help here.

I have the full decoder for a LoRaWAN Wavetrend Water Monitor. Decoder is written in JavaScript, and currently compatible with The Things Stack. Works perfectly.

In one instance I need to use LORIOT, so will need to decode/parase in Tago.Io

The decoder is quite complex. However, a large portion deals with the initial installation side of things. For the important data the following part formats the temperature data -


    
    case 0x03:
      {
          pack_type   = "temperaturereport";
          sequence    = input.bytes[2];
          device_time = (input.bytes[6] | input.bytes[5] <<8 | input.bytes[4] <<16 | input.bytes[3] <<24);
          
          var sensor_1_min          = (input.bytes[7] << 24) >> 24;
          var sensor_1_max          = (input.bytes[8] << 24) >> 24;
          var sensor_1_flow_count   = input.bytes[9];
          var sensor_1_compliant    = input.bytes[10];
          
          var sensor_2_min          = (input.bytes[11] << 24) >> 24;
          var sensor_2_max          = (input.bytes[12] << 24) >> 24;
          var sensor_2_flow_count   = input.bytes[13];
          var sensor_2_compliant    = input.bytes[14];
          
          var sensor_3_min          = (input.bytes[15] << 24) >> 24;
          var sensor_3_max          = (input.bytes[16] << 24) >> 24;
          var sensor_3_flow_count   = input.bytes[17];
          var sensor_3_compliant    = input.bytes[18];
          

          return {
                    data:
                    {
                      "type"         : pack_type,
                      "sequence"     : sequence,
                      "devicetime"   : device_time,
                      
                      "sensor1mintemp"   : sensor_1_min,
                      "sensor1maxtemp"   : sensor_1_max,
                      "sensor1flowcount" : sensor_1_flow_count,
                      "sensor1compliant" : sensor_1_compliant,
                      
                      "sensor2mintemp"   : sensor_2_min,
                      "sensor2maxtemp"   : sensor_2_max,
                      "sensor2flowcount" : sensor_2_flow_count,
                      "sensor2compliant" : sensor_2_compliant,
                      
                      "sensor3mintemp"   : sensor_3_min,
                      "sensor3maxtemp"   : sensor_3_max,
                      "sensor3flowcount" : sensor_3_flow_count,
                      "sensor3compliant" : sensor_3_compliant
                    },
                 };
        
        
      }break;      


I have no idea how to format this for LoRaWAN parase in Tago.io

If someone could assist, or better still - add a new device into the repository? I have shared/attached the entire decoder. Hopefully this can help others too.