Noob - No traffic Dragino > Chirpstack v4

Hello folks:

I’m trying to activate several Arduino MKRWAN boards on Chirpstack using a Dragino LPS8N.

The gateway and Arduino’s were working previously on the Things Network, but I had to switch to Chirpstack due to firmware compatibility issues between the Arduinos and TTN.

After several weeks of reading docs, test configs, more reading, more tests I’ve reached a standstill. I have the Dragino configured correctly and have configured Chirpstart according to the guides. I can see packets leaving the Dragino, packets arriving at the Chirpstack Gateway (located on the host, not the Dragino), and the forwarded packets arriving at the Chirpstack Main Program. BUT, according to the Chirpstack GUI , there are no packets acknowledged and no LORAWAN frames arrive.

**With The API BIND statement in chirpstack.toml set at #bind “0.0.0.0:8080”, the resulting output from ‘chirpstack.toml’ returns **

*Following a suggestion from another post I set the BIND statement to empty #bind “” . The result was packets beginning to flow freely. I though it was fixed, but without the bind statement the packets are tying up port 8080, and now the Chirpstack GUI is either refusing or unable to load. If I change the Bind back to “0.0.0.0:8080” the GUI returns to normal, but the packets again halt. I’m caught in a circle.

My hardware:

  • Dell PowerEdge blade server running VMware ESXi 7.6.3
  • VM is running Ubuntu 22.04.3 LTS x64 (VM is assigned 10GB DDr4 RAM, 120GB SAS)
  • Chirpstack is V4.x latest release, Mosquitto and other support programs are the latest
    -Dragino LPS8N Firmware is 5.4 –Dragino is configured for Semtech UDP

Network: Both the Dragino and Chirpstack VM are on the same subnet: 10.10.30.X/24. Both end devices are reachable from the other

Other than unique changes to the regions, passwords, and the above-mentioned API BIND statement my gateway and chirpstack toml files are stock from the website examples.

Please help, after wasting a month on TTN with no solution, I’ve bet all my money on Chirpstack.

Sorry, I have other things to post, but as a new member, the forum will only let me post one item.
:face_with_diagonal_mouth:
Thanks!

The port 8080 is used for web and gRPC traffic. You should study the networking between the Gateway Bridge and your LoRa Gateway. It likely involves UDP port 1700.

Binding means that only packets that come through network interfaces with matching addresses will be accepted. So if you put 0.0.0.0 (which I believe is the default), connections can come from anywhere.

If I remember correctly, the API that is disabled, refers to something else.

Please look at the logs for the Gateway Bridge first, to determine whether it can communicate with the gateway. You should increase verbosity to debug or trace, to see the exchange of GWMP UDP messages with the gateway.

Okay…another 12 hours of beating my head into the wall with zero progress…

You are correct, the API bind command doesn’t appear to be the problem.

But what is worse is that I cannot seem to isolate what IS causing the problem. I took the following measures:

  1. Turned on debug, but it didn’t provide much usable new info

  2. I moved the Gateway Bridge from the Chirpstack virtual machine and installed it directly on the Dragino gateway. I configured it exactly as directed by Dragino and Chirpstack, but still nothing 'was recognized by Chirpstack

From the console output below, it ‘appears’ that packets are received by Chirpstack. it processes the incoming messages and subscribes to the gateway traffic, but NOTHING ever gets past the incoming buffer and into the database, the LORAWAN gateway packet counter is a big fat zero and says “Never Seen”

Please note the one error in the trace below, I don’t think it is the problem, but it’s the only anomaly I can find

Please ! Any new ideas??? I have reconfigured everything 100 times, at this point I’m just moving in circles. I expected to have a more difficult time with the end devices, connecting the gateway is usually the easiest part.

Thanks

I would suggest picking a pattern and staying with it. Having come from outside Chirpstack, I believe that using either the UDP packet forwarder or Semtech BasicStation would allow you to move between LNS.

I see an “event/conn” message in your screenshot. This means that the gateway has either become online or offline. If it stayed offline (e.g. “never seen”), then it could mean that the gateway bridge never successfully received the statistics message from it.

That being said, did you look at the gateway bridge’s logs? I don’t think anything can really go wrong between Chirpstack and the Chirpstack Gateway Bridge (GWB) because they are both components of Chirpstack, so you should confirm that the GWB is receiving messages from the gateway. If you find no message logged (regarding the gateway’s messages) while the GWB has verbosity turned to either debug or trace, then you probably have some sort of networking problem.

In your second screenshot I see an error message: Unknown event type region_id=us915_0 and in your first screenshot I see that chirpstack is subscribing to region us915_4 so maybe you haven’t enabled the right region in chirpstack config enabled_regeions or don’t set the mqtt topics right in the gateway bridge. You can also try to subscribe with an mqtt client to your mqtt broker to -t ‘#’ to see whats going on there an turn gateway bridge marshaler to json.

SP193;

Thank You, I did see the debug errors, but could not determine the exact cause. so I solved the problem by erasing all the devices and starting with a fresh set of code. The Gateway joined the server and was able to add devices. Thank you!

I still have a problem, but its not technical, its a lack of programming knowledge on my part. I am a WAN engineer and do not work at code or API level, most sensors and equipment I use already has pre-built APIs that ingest uploaded ASCII data and convert it to hex/binary transmissions over the WAN, my focus is on the WAN equipment and ensuring an error-fee transmission path.

In this case I have to take sensor readings (ie DHT22 etc) attached to an Arduino MKR WAN, and convert them to a hex payload stream. I have been with successful with Arduino to Chirpstack Server communications: The device joins successfully, and traffic is going up and down:

However, I am unable to recover any of my sensor readings (all are just simple Celsius temperature data) on the Chirpstack Server. I believe that my Arduino sketch is flawed and that the data received is not formatted properly to allow decode. To be completely honest my JSON and Arduino coding skills are very basic, programming sensor data into payloads using advanced javascript is above my head. Do you know of any pre-made arduino>Chirpstack sketches available anywhere online? If I have a template I have enough skill to adapt it to my needs, I just don’t have the knowledge to write from scratch.

Thanks

Some more screenshots to support my earlier post:

These are the Link metrics, updating normally as packets are received. Of course these are ‘built-in’ and dont require any coding on my part:

These are the Device Metrics …empty… I have failed to provide the proper encoding (on the Arduino side) and decoding (on the Chirpstack side) to fill these charts. This is the goal.

I feel like you’re either skipping a lot of details or perhaps something isn’t sufficiently clear to you. Let’s start with the basics first.

LoRaWAN allows a certain number of bytes to be sent over the air, without specifying how the payloads must be encoded. The format of the payloads is defined by the device maker. It’s possible to convey readings as individual bytes or even bits of a byte.

Since the odds of collisions increases with the payload length, keeping messages as short as possible would be ideal. Formats like JSON introduce unnecessary overhead.

Chirpstack is a LoRa Network Server, which communicates with devices through LoRaWAN, via LoRa gateways. The payload is made available to 3rd party applications and also displayed via its UI. Since the payload can be interpreted as a sequence of bytes, this is the default representation (as seen in your post #6). If you register a codec, you can decode this message into a JSON representation. But this is another, optional step that you can get Chirpstack to take.


So, I don’t think it is necessary for you to have written the codec, yet. Since you’re working on an end-to-end solution, I suggest breaking this problem into two. If you designed and wrote the code on the Arduino to convert the sensor input into the uplink payload, you should be able to interpret that sequence of bytes indicated by Chirpstack, by hand. If you are able to do that and the values makes sense to you, then the data coming from the Arduino has been correctly encoded and transmitted.

If you need coding help, do post the code that you’ve written. At least the part that reads the values from the sensors and encodes them into the message for transmission.

sp193:

You are correct, its not clear at all. As a WAN engineer, I work almost exclusively at OSI model layers 1 - 5, I handle very little application layer protocols; they are provided to us as pre-compiled and provided to us as complete programs. That said, your explanation did help fill in many areas of missing knowledge. Thank you.

The following is the Arduino code I am using. It is a mix of self-developed code through trial and error, and other pieces were added from sketches found on various forums. This code does compile and successfully registers with my Chirpstack server, but as mentioned, the packets either contain no sensor payload or the payload is not formatted correctly:

The MKRENV is an Arduino Shield that provides onboard sensor readings to the motherboard: Temperature, Humidity, Pressure, Lux, and UV index

#include <Arduino_MKRENV.h>
#include <SPI.h>
#include <MKRWAN_v2.h>


int counter = 0;
LoRaModem modem;


void setup() {
Serial.begin(115200);
 
 // Init modem & Send OTAA EUI ID
  modem.begin(US915);
 int connected = modem.joinOTAA("3535313166377b0a", "a9fca61b82e9b0bb9348a1bcb1e3afae");
 
  //INITIALIZE Arduino  MKRENV BOARD
  ENV.begin();
}

void loop() {
 
  //Assign MKWENV Sensor Variables
 
  float temp  = ENV.readTemperature();
  float hum    = ENV.readHumidity();
  float pressure    = ENV.readPressure();


//translate float value to int 16 bit *100 
 int16_t temperature = (int16_t)(temp  * 100);
 int16_t barometer = (int16_t) pressure ;
 int16_t humidity = (int16_t)(hum  * 100);

 //shift bits and store the value in bytes
  byte data[6];
  data[0] = temperature >> 8;
  data[1] = temperature & 0xFF;
  data[2] = barometer >>8;
  data[3] = barometer & 0xFF;
  data[4] = humidity >> 8;
  data[5] = humidity & 0xFF;

//show data in the serial monitor
Serial.print (temp);
Serial.print (pressure);
Serial.print(hum);
  
 //send the data to the gateway.
  modem.setPort(1); 
  modem.beginPacket();
  modem.write(data, sizeof(data));
  modem.endPacket(false);
    
  delay(15000);   // send a message every 15 seconds for TESTING ONLY
 }

Thank you for sharing the code and explaining what hardware you use. Your data format consists of 6 bytes and looks like this:

TTttBBbbHHhh
Field Description
TTtt Temperature (℃) x100
BBbb Air Pressure (kPa)
HHhh Humidity (% rH) x100

Each field is 16-bit, encoded in big-endian format. Whereby uppercase denotes the upper octet, while lowercase denotes the lower octet.

However, this doesn’t seem to align with what we see in post #6, which suggests that this is a different version of your program. The payloads there are 7 bytes long and are sent on FPort 3 (instead of 1, as shown in your code).

So anyway, you need to verify whether you can decode the data shown with this knowledge.
You are also printing the values read from the sensors on the Arduino’s side. If the values shown in the terminal look correct, there should be no issues with your hardware.

For example, we have this 7-byte payload shown in post #6: 1ebc0c5c017900

TTttBBbbHHhh??
1ebc0c5c017900

It’s 7 bytes for some reason (likely a different program), so I ignore the 7th byte. The values don’t seem to be correct, but let’s assume they are for a moment.

I referred to this document regarding the behaviour of the API, in conjunction with the reference for the MKRENV library: https://docs.arduino.cc/tutorials/mkr-env-shield/mkr-env-shield-basic

Field Value Decoded
TTtt 0x1EBC 78.68℃
BBbb 0x0C5C 3164 kPa
HHhh 0x0179 3.77% rH

(One thing that makes me wonder is, whether this version just had a different layout from the one you posted. For example, TTtt here is actually humidity, BBbb is the temperature, HHhh is the barometer… which means 78.68% rH, 31.64℃ and 3.77 kPa)


Assuming that there are no problems with the Arduino side, what is the codec script that you are using for Chirpstack like?
The goal is to convert the payload (an array of bytes) into JSON, which is a more human-readable representation of the data.

I’ve not used the device charts before. But surely you need to configure them, including specifying which attribute to plot the graph with. This likely needs to align with the returned structure from decoding. Do feel free to post what you have entered for this too.


On a side note: you mentioned that sometimes, there are uplinks with no payload. This may be because the message was sent by the LoRaWAN link layer (similar to OSI layer 2), containing only MAC commands.

1 Like

:clap: Now I get it ! I made two stupid mistakes, I was grouping by four bytes, but my dumbest mistake was trying to convert HEX > TEXT, when I need HEX>DECIMAL.

Yes, my earlier sketch was different. The last sketch I sent is the most accurate, six bytes and fp1

So, following your example with this recent server payload:

Payload = 0927 (TTtt), 0060, HHhh), and 0be9 (PPpp)

Converted to Decimal: 2343, 96, 3049

Notation, parameter added: 23.43C, 96% (Humidity) , 3049Pa

So now a success, three sensor parameters are received at the device buffer, but still have to apply my very flawed DEVICE PROFILE/PAYLOAD CODEC>javascript function/codec Function which is as follows:

``Function Decode(1, 6){  
 //  (port, bytes)

var data = {
//External sensor
Ext_sensor:
{
“0”:“Temperature”,
“1”:“Humidity”,
“2”:“Pressure”,

   }


   
   //Temperature
   Temp:((bytes[0]<<8 | bytes[1])*100),
   
  // Humidity 
   Hum:((bytes[2]<<8 | bytes[3])),
   
   //Pressure:
   Pressure:((bytes[4]<<8 | bytes[5])*100),
   }[bytes[6]&0xFF],       
};
return data;
}


I created three Measurement Functions to hold the decoded payload data, but so far the Device Metrics Charts are empty of data.

We are almost there! My Javascript CODEC decoder is obviously the problem.

Thanks!

Brian

MEASUREMENT in Device Profile are defined as:

I also confirmed the validity of the Temperature Sensor:

I placed my thumb over the sensor on the MKR ENV board. The received hex code on the Chirpstack sensor changed from 0927 (23C) to 0B58 (29C)

Brian

The arguments are variables too.
You need to divide by 100, since you previously multiplied by 100.
The goal is to return an object, so we compute the values and return an object.
JavaScript has no concept of unsigned bytes, so we probably need to perform a logical AND with 0xff. Otherwise, sign-extension could occur and the wrong bits will get OR’ed into the result. Unless we can be sure that only unsigned values will be passed in.
It is better to give the attributes of the object, meaningful names.


function Decode(port, bytes) {  
    var temperature = ((bytes[0] & 0xff ) << 8 | (bytes[1] & 0xff)) / 100;
    var humidity = (bytes[2] & 0xff) << 8 | (bytes[3] & 0xff);
    var pressure = ((bytes[4] & 0xff) << 8 | (bytes[5] & 0xff)) / 100;
    return {
        temperature: temperature,
        humidity: humidity,
        pressure: pressure
    };
}
1 Like

Mr. Liu: I still cannot get the payloads to decode into the application “gauges.”
I can see the payload and sensor data, and can manually decode. I believe all the sensor variables are properly assigned to gauges, but nothing registers.

Before troubleshooting further, I received a Dragino LHT65N in the mail. I will connect it and see if I can recover the data in the chirpstack server. Removing the Arduino will eliminate a lot of technical problems and unknown factors. I will report the results in a few days. Thank You, Brian

Mr. Liu

Good News- I was able to decode packets with the Dragino LHT65N, I did not have to create the fields, Chirpstack was able to auto-create them.

The decoder used for the Dragino is quite complex. I created a fork of the source Dragino repository here: Dragino Decoder Repro - Fork

Here is the working Dragino Decoder: (recently updated for Chirp V4)

function decodeUplink(input) {
        return { 
            data: Decode(input.fPort, input.bytes, input.variables)
        };   
}

function Str1(str2){
  var str3 ="";
  for (var i=0;i<str2.length;i++){
    if (str2[i]<=0x0f){
    str2[i]="0"+str2[i].toString(16)+"";
    }
  str3+= str2[i].toString(16)+"";}
  return str3;
}
function str_pad(byte){
    var zero = '00';
    var hex= byte.toString(16);    
    var tmp  = 2-hex.length;
    return zero.substr(0,tmp) + hex + " ";
}

function datalog(i,bytes){
  var Ext= bytes[6]&0x0F;
  var bb;
  	if((Ext=='1')||(Ext=='9'))
{
	bb=parseFloat(((bytes[0+i]<<24>>16 | bytes[1+i])/100).toFixed(2));
}
  	else if(Ext=='2')
{
	bb=parseFloat(((bytes[0+i]<<24>>16 | bytes[1+i])/100).toFixed(2));
}
	else if(Ext=='4')
{
	var Exti_pin_level=bytes[0+i] ? "High":"Low";  
    var Exti_status=bytes[1+i] ? "True":"False";
    bb=Exti_pin_level+Exti_status;
}
	else if(Ext=='5')
{
	bb=bytes[0+i]<<8 | bytes[1+i];
}
	else if(Ext=='6')
{
	bb=(bytes[0+i]<<8 | bytes[1+i])/1000;
}
	else if(Ext=='7')
{
	bb=bytes[0+i]<<8 | bytes[1+i];
}
	else if((Ext=='8')||(Ext=='14'))
{
	bb=bytes[0+i]<<8 | bytes[1+i];
}
else if(Ext=='11')
{
  bb=parseFloat(((bytes[0+i]<<24>>16 | bytes[1+i])/100).toFixed(2));  
}
  var cc= parseFloat(((bytes[2+i]<<24>>16 | bytes[3+i])/100).toFixed(2));
  var dd= parseFloat((((bytes[4+i]<<8 | bytes[5+i])&0xFFF)/10).toFixed(1));
  var ee= getMyDate((bytes[7+i]<<24 | bytes[8+i]<<16 | bytes[9+i]<<8 | bytes[10+i]).toString(10));
  var string='['+bb+','+cc+','+dd+','+ee+']'+',';  
  
  return string;
}

function getzf(c_num){ 
  if(parseInt(c_num) < 10)
    c_num = '0' + c_num; 

  return c_num; 
}

function getMyDate(str){ 
  var c_Date;
  if(str > 9999999999)
    c_Date = new Date(parseInt(str));
  else 
    c_Date = new Date(parseInt(str) * 1000);
  
  var c_Year = c_Date.getFullYear(), 
  c_Month = c_Date.getMonth()+1, 
  c_Day = c_Date.getDate(),
  c_Hour = c_Date.getHours(), 
  c_Min = c_Date.getMinutes(), 
  c_Sen = c_Date.getSeconds();
  var c_Time = c_Year +'-'+ getzf(c_Month) +'-'+ getzf(c_Day) +' '+ getzf(c_Hour) +':'+ getzf(c_Min) +':'+getzf(c_Sen); 
  
  return c_Time;
}

function Decode(fPort, bytes, variables) {
var Ext= bytes[6]&0x0F;
var poll_message_status=((bytes[6]>>6)&0x01);
var retransmission_Status=((bytes[6]>>7)&0x01);
var Connect=(bytes[6]&0x80)>>7;
var decode = {};
var data = {};
if((fPort==3)&&((bytes[2]==0x01)||(bytes[2]==0x02)||(bytes[2]==0x03)||(bytes[2]==0x04))){
	var array1=[]
	var bytes1="0x"
	var str1=Str1(bytes)
	var str2=str1.substring(0,6)
	var str3=str1.substring(6,)
  var reg=/.{4}/g;
	var rs=str3.match(reg);
	rs.push(str3.substring(rs.join('').length));
	rs.pop()
	var new_arr = [...rs]
	var data1=new_arr
	decode.bat=parseInt(bytes1+str2.substring(0,4)& 0x3FFF)
	if (parseInt(bytes1+str2.substring(4,))==1){
		decode.sensor="ds18b20"
	}
	else if(parseInt(bytes1+str2.substring(4,))==2){
	  decode.sensor="tmp117"
	}
	else if(parseInt(bytes1+str2.substring(4,))==3){
		decode.sensor="gxht30"
	}
	else if(parseInt(bytes1+str2.substring(4,))==4){
		decode.sensor="sht31"
	}	
	for (var i=0;i<data1.length;i++){
    var temp=(parseInt(bytes1+data1[i].substring(0,4)))/100
    array1[i]=temp
}
	decode.Temp=array1
	{
    return decode;
  }
}	
else if(fPort==5)
{
  var sub_band;
  var freq_band;
  var sensor;
    
  if(bytes[0]==0x0B)
    sensor= "LHT65N";
  else if(bytes[0]==0x1A)
    sensor= "LHT65N-PIR";
  
  if(bytes[4]==0xff)
    sub_band="NULL";
  else
    sub_band=bytes[4];
    
  if(bytes[3]==0x01)
    freq_band="EU868";
  else if(bytes[3]==0x02)
    freq_band="US915";
  else if(bytes[3]==0x03)
    freq_band="IN865";
  else if(bytes[3]==0x04)
    freq_band="AU915";
  else if(bytes[3]==0x05)
    freq_band="KZ865";
  else if(bytes[3]==0x06)
    freq_band="RU864";
  else if(bytes[3]==0x07)
    freq_band="AS923";
  else if(bytes[3]==0x08)
    freq_band="AS923_1";
  else if(bytes[3]==0x09)
    freq_band="AS923_2";
  else if(bytes[3]==0x0A)
    freq_band="AS923_3";
  else if(bytes[3]==0x0B)
    freq_band="CN470";
  else if(bytes[3]==0x0C)
    freq_band="EU433";
  else if(bytes[3]==0x0D)
    freq_band="KR920";
  else if(bytes[3]==0x0E)
    freq_band="MA869";
      
  var firm_ver= (bytes[1]&0x0f)+'.'+(bytes[2]>>4&0x0f)+'.'+(bytes[2]&0x0f);
  var bat= (bytes[5]<<8 | bytes[6])/1000;
    
  return {
    SENSOR_MODEL:sensor,
    FIRMWARE_VERSION:firm_ver,
    FREQUENCY_BAND:freq_band,
    SUB_BAND:sub_band,
    BAT:bat,
  };
}
if (retransmission_Status==0)
{
switch (poll_message_status) {		
case 0:	
{ 
if(Ext==0x09)
{
  decode.TempC_DS=parseFloat(((bytes[0]<<24>>16 | bytes[1])/100).toFixed(2));
  decode.Bat_status=bytes[4]>>6;
}
else
{
  decode.BatV= ((bytes[0]<<8 | bytes[1]) & 0x3FFF)/1000;
  decode.Bat_status=bytes[0]>>6;
}

if(Ext!=0x0f)
{
  decode.TempC_SHT=parseFloat(((bytes[2]<<24>>16 | bytes[3])/100).toFixed(2));
  decode.Hum_SHT=parseFloat((((bytes[4]<<8 | bytes[5])&0xFFF)/10).toFixed(1));
}
if(Connect=='1')
{
  decode.No_connect="Sensor no connection";
}

if(Ext=='0')
{
  decode.Ext_sensor ="No external sensor";
}
else if(Ext=='1')
{
  decode.Ext_sensor ="Temperature Sensor";
  decode.TempC_DS=parseFloat(((bytes[7]<<24>>16 | bytes[8])/100).toFixed(2));
}
else if(Ext=='2')
{
  decode.Ext_sensor ="Temperature Sensor";
  decode.TempC_TMP117=parseFloat(((bytes[7]<<24>>16 | bytes[8])/100).toFixed(2));
}
else if(Ext=='4')
{
  decode.Work_mode="Interrupt Sensor send";
  decode.Exti_pin_level=bytes[7] ? "High":"Low";  
  decode.Exti_status=bytes[8] ? "True":"False";
  decode.Exit_count= bytes[9]<<16 | bytes[10]<<8 | bytes[11];
  decode.Exit_duration= bytes[12]<<16 | bytes[13]<<8 | bytes[14];
}
else if(Ext=='5')
{
  decode.Work_mode="Illumination Sensor";
  decode.ILL_lx=bytes[7]<<8 | bytes[8];
}
else if(Ext=='6')
{
  decode.Work_mode="ADC Sensor";
  decode.ADC_V=(bytes[7]<<8 | bytes[8])/1000;
}
else if(Ext=='7')
{
  decode.Work_mode="Interrupt Sensor count";
  decode.Exit_count=bytes[7]<<8 | bytes[8];
}
else if(Ext=='8')
{
  decode.Work_mode="Interrupt Sensor count";
  decode.Exit_count=bytes[7]<<24 | bytes[8]<<16 | bytes[9]<<8 | bytes[10];
}
else if(Ext=='9')
{
  decode.Work_mode="DS18B20 & timestamp";
  decode.Systimestamp=(bytes[7]<<24 | bytes[8]<<16 | bytes[9]<<8 | bytes[10] );
}
else if(Ext=='11')
{
  decode.Work_mode="SHT31 Sensor";
  decode.Ext_TempC_SHT=parseFloat(((bytes[7]<<24>>16 | bytes[8])/100).toFixed(2));
  decode.Ext_Hum_SHT=parseFloat((((bytes[9]<<8 | bytes[10])&0xFFF)/10).toFixed(1));  
}
else if(Ext=='14')
{
  decode.Work_mode="PIR Sensor";
  decode.Exti_pin_level=bytes[7] & 0x01 ? "Activity":"No activity";
  decode.Move_count=bytes[8]<<16 | bytes[9]<<8 | bytes[10];
}
else if(Ext=='15')
{
  decode.Work_mode="DS18B20ID";
  decode.ID=str_pad(bytes[2])+str_pad(bytes[3])+str_pad(bytes[4])+str_pad(bytes[5])+str_pad(bytes[7])+str_pad(bytes[8])+str_pad(bytes[9])+str_pad(bytes[10]);
}
}
  if((bytes.length==11)||(bytes.length==15))
  {
    return decode;
  }
break;

case 1:
  {
    for(var i=0;i<bytes.length;i=i+11)
    {
      var da= datalog(i,bytes);
      if(i=='0')
        decode.DATALOG=da;
      else
        decode.DATALOG+=da;
    }
}
{
return decode;
}
break;
default:
    return {
      errors: ["unknown"]
    }
}
}
else
{
switch (retransmission_Status) {
  case 1:
  {
    for(var i=0;i<bytes.length;i=i+11)
    {
      var da= datalog(i,bytes);
      if(i=='0')
        data.retransmission_message=da;
      else
        data.retransmission_message+=da;
    }
}
{
return data;
}
break;
default:
    return {
      errors: ["unknown"]
    }
}
}
}

Here is my current decoder based on your suggestion: (please note that I expanded the decoder to include all six parameters of the Arduino MKRENV Board: Temperature, Humidity, Pressure, Illumination, UVA, UVB, UV Index - The length is no longer six bytes, its now 14 bytes)


function Decode(port, bytes) {  
    var temperature = ((bytes[0] & 0xff ) << 14 | (bytes[1] & 0xff)) / 100;
    var humidity = (bytes[2] & 0xff) << 14 | (bytes[3] & 0xff);
    var pressure = ((bytes[4] & 0xff) << 14 | (bytes[5] & 0xff)) / 100;
    var ill= ((bytes[6] & 0xff) << 14 | (bytes[7] & 0xff));
    var UVA = ((bytes[8] & 0xff) << 14 | (bytes[9] & 0xff));
    var UVB = ((bytes[10] & 0xff) << 14 | (bytes[11] & 0xff));
    var UV_Index= ((bytes[12] & 0xff) << 14 | (bytes[13] & 0xff)); 
return {
        temperature: temperature,
        humidity: humidity,
        pressure: pressure, 
        illumination: ill,
        UVA: UVA, 
        UVB: UVB, 
        UV_Index: UV_Index 
   
    };
}

Unfortunately, but NOT unexpectedly, this decoder still fails to function. I tried manually creating the variables, and tried with “AUTO”. It won’t decode and/or fill in any variables.

My Apologies,I have made great progress, but again need your help.

Thank You

Brian

Does Chirpstack successfully decode with your codec? Under the Events tab, it’s supposed to show all those decoded values and not just the raw payload, according to what you have written. There should be also no errors with decoding.

Hi and thanks again:

Yes, your comments make sense, however, the Dragino Packets are decoding and posting to the gauges, even though they appear as a single-byte streams in the packet monitor.

Very confusing

Dragino Events:

Device Metrics decode and post??

Arduino MKRWAN sensor data also appears in EVENTS

But no decode and post to the gauges occurs: :confounded:

You should click the + besides “Up” to see if the data is decoded.

Datnus:

Neither the Dragino or the Arduino payloads appear with headers suing the +UP button. The embedded fields of RSSI, SNR. etc do appear, but no actual sensor data,

I can manually decode the hex code from both payloads and translate them into decimal; it is correct.

Additionally, the Dragino’s payloads are automatically detected and posted to the Chirpstack device metrics page.

Its only the Arduino that I cannot get to decode

It means ChirpStack is unable to decode the data.

Due to missing device profile and codec in the device profile.

Try with Dragino device first.
DIY devices may have coding issue.