When I tried to send data to device, I got a handle data-down payload error

I think I encountered this problem today. Here is the message from the log:

time=“2018-05-02T15:53:20-06:00” level=error msg=“handle data-down payload error: marshal codec payload to binary error: function must return type slice, got: []int64” application_id=2 dev_eui=647fda000000066c reference=abcd1234

Did you use the binary from the dropbox link (scroll a bit up)? If not: that is exactly what this snapshot is trying to fix and I’m planning to release this soon.

If you do use this snapshot, please let me know how to reproduce this issue, so I can fix this before the next release.

I did not download the snapshot yet … I wanted to confirm this was the same issue. As a temporary workaround, I used floats for all my values.

If you have time to test it, please share your feedback. It should also give you the encoder / decoder errors on the .../error MQTT topic + live device events in the web-interface :slight_smile:

I installed the snapshot from the drop box but I still get the type conversion error.

Here is the log:

time=“2018-05-03T09:52:27-06:00” level=error msg=“handle data-down payload error: marshal codec payload to binary error: invalid slice value, int64” application_id=3 dev_eui=647fda0000000765 reference=abcd1234

Here is the mqtt error topic:

May 03 09:52:27 application/3/node/647fda0000000765/error {“applicationID”:“3”,“applicationName”:“test”,“deviceName”:“tektelic-industrial”,“devEUI”:“647fda0000000765”,“type”:“CODEC”,“error”:“invalid slice value, int64”}

Also, I had an instance where an int32 type did not work either.

And if you push an array of floats as one of the elements in the array, it fails as well:

May 03 12:31:26 application/3/node/647fda0000000765/error {“applicationID”:“3”,“applicationName”:“p263-crusher-shutdown-control”,“deviceName”:“tektelic-industrial”,“devEUI”:“647fda0000000765”,“type”:“CODEC”,“error”:“invalid slice value, []float64”}

Hi,
I tested the snapshot with my encode function:

function Encode(fPort, obj) {
  return [obj.timestamp>>24 && 0xFF,obj.timestamp>>16 && 0xFF,obj.timestamp>>8 && 0xFF,obj.timestamp && 0xFF];
} 

In this case downlink happens but i just receive 0xFF bytes. I changed the mask symbol to this:

function Encode(fPort, obj) {
  return [obj.timestamp>>24 & 0xFF,obj.timestamp>>16 & 0xFF,obj.timestamp>>8 & 0xFF,obj.timestamp & 0xFF];
}

And now i’m getting this error:

May 03 20:43:54 GreenISys lora-app-server[19994]: time="2018-05-03T20:43:54+01:00" level=info msg="handler/mqtt: publishing message" qos=0 topic=application/2/node/0004a30b001ebebc/error
May 03 20:43:54 GreenISys lora-app-server[19994]: time="2018-05-03T20:43:54+01:00" level=error msg="handle data-down payload error: marshal codec payload to binary error: function must return type slice of ints or floats, got: []int32" application_id=2 dev_eui=0004a30b001ebebc reference=abcd1234 

My encoder function is wrong?
Thanks

Thanks for the feedback @ruben_gr and @sslupsky. I will look into it!

That is expected, btw. As it will make your array look like [a, b, c, [d, e, f]] which is not a valid byte array.

My assumption was that the JS VM would only return certain types and I was wrong (assumptions…). I’ve updated the code to handle every possible int / float in the returned array:

@ruben_gr @sslupsky I think this should solve all the reported issues. Thanks again for reporting these. As different Encode functions are returning different types, these errors did not show up in my testing.

Could you test (hopefully) one more time? I’ve created new snapshots including the above change:

Fixes for the above issues have released: https://forum.loraserver.io/t/release-lora-server-0-26-2-and-lora-app-server-0-20-2/1271

Hi @brocaar

Now it’s working (I tested from last snapshot not the release version). I send 1522266426 and receive in RN2483 5ABBF13A in first max_rx.

Why i’m not receiving mac_tx_ok after mac_rx 10 5ABBF13A? Do you know?

Thanks

You can post the steps you followed to receive data to your device. Also the structure of your file to send the data.
I have not been successful yet, my device says it has not received packages.
Thank you.