Payload decoder inconsistent output

Hi

I am having a strange issue with a few of my decoders, for the most part they work as expected but occasionally i get a bad interpretation of a payload. When I run this SAME payload through the payload test function it works fine.

screen shots attached

Expected JSON output / output using SAME raw payload as :
{
“BatteryVoltage”: {
“channel”: 1,
“unit”: “Volt”,
“value”: 3.631
},
“Hex”: {
“channel”: 1,
“unit”: null,
“value”: “0100EB023C04018C0500070E2F1102”
},
“Humidity”: {
“channel”: 1,
“unit”: “Relative Humidity”,
“value”: 60
},
“Lux”: {
“channel”: 1,
“unit”: “Lux”,
“value”: 396
},
“OccupancyHistory”: {
“channel”: 1,
“unit”: null,
“value”: 0
},
“OccupancyIntensity”: {
“channel”: 1,
“unit”: null,
“value”: 2
},
“Port”: {
“channel”: 1,
“unit”: null,
“value”: 1
},
“TemperatureAtm”: {
“channel”: 1,
“unit”: “Degree Celsius”,
“value”: 23.5
}
}

Observed JSON output, in application data traffic:
{
“BatteryVoltage”: “map[unit:Volt value:3.631 channel:1]”,
“Hex”: “map[channel:1 unit: value:0100EB023C04018C0500070E2F1102]”,
“Humidity”: “map[channel:1 unit:Relative Humidity value:60]”,
“Lux”: “map[value:396 channel:1 unit:Lux]”,
“OccupancyHistory”: “map[channel:1 unit: value:0]”,
“OccupancyIntensity”: “map[channel:1 unit: value:2]”,
“Port”: “map[channel:1 unit: value:5]”,
“TemperatureAtm”: “map[unit:Degree Celsius value:23.5 channel:1]”
}

Any ideas what’s going on?

data traffic - unexpected result:
image

retry raw payload in test - works fine
image

very surpised no one else is experiencing this issue?

I’ve been looking at the two screen shots for a while now and I am unable to spot the difference. Could you elaborate on what part of the output is unexpected?

Hi Mikael,

The actual data log from the sensor produced JSON that used “…map[ ]…” in the run time logs given a specific raw payload

yet, when I run the same raw payload through the decoder test tool, it produces JSON without “map[]”

inconsistent

This is due to looking at “historical” data, as indicated in the first line of your screenshot. That data was received before you opened the browser. See Why application data is shown as historical? - #2 by arjanvanb

4 Likes

Did you change the original decoder? Originally the decoder does not get a port number:

function Decoder(bytes, port) {
return DecodeElsysPayload(bytes);
}

so I´m wondering, where the values come from.

As the Elsys decoder does not create an object on error

      default: //somthing is wrong with data
           i=data.length;
      break

you will get a raw buffer in this case. Maybe for test purpose it is worth to include the raw data into the payload like obj.buffer = bytes; (did not test that, possibly need to create the buffer first).

Yes, I have adapted the Elsys decoder for my purposes

I can confirm that the MQTT data for this packet did come thru as the expected JSON (without the map)

Thanks arjanvanb for the link