iegomez/lds

I don't receive the encoded data

Closed this issue · 4 comments

I'm facing an issue using the encoded data function.
I activated the encoded option and I kept the default data objects :

image

image

However, Chirsptack don't seem to receive the whole data when i sent it as you can see :

image

So I tried to add another object and sent a new data payload but the number of encoded digits is still the same.

Hi Vincent,

Could you please provide your full configuration file?

Thank you!

Sure! Here it is


log_level = "info"

[mqtt]
  server = "tcp://192.168.43.103:1883"
  user = ""
  password = ""
  # Uplink topic. %s will be replaced with the gateway mac.
  uplink_topic="gateway/%s/event/up"
  # Downlink topic. %s will be replaced with the gateway mac.
  downlink_topic="gateway/%s/command/down"

[forwarder]
  nserver = "192.168.43.103"
  nsport = "1680"

[gateway]
  mac = "dca632ffffa8bc6e"

[band]
  name = "EU_863_870"

[device]
eui="1111111111111111"
address="000f6e3b"
network_session_encription_key="dc5351f56794ed3ac17c382927192858"
serving_network_session_integrity_key="dc5351f56794ed3ac17c382927192858"
forwarding_network_session_integrity_key="dc5351f56794ed3ac17c382927192858"
application_session_key="7b14565ba0e30d6ced804393fd6a0dd5"
marshaler="json"
nwk_key="01020304050607080910111213141516"
app_key="01020304050607080910111213141516"
join_eui="0000000000000002"
mac_version=1
profile="OTAA"
joined=false
skip_fcnt_check=true

[data_rate]
  bandwith = 125
  spread_factor = 10
  bit_rate = 0

[rx_info]
  channel = 0
  code_rate = "4/5"
  crc_status = 1
  frequency = 868300000
  lora_snr = 7.0
  rf_chain = 1
  rssi = -57

[raw_payload]
  payload = "ff00"
  use_raw = false
  script = "\n// Encode encodes the given object into an array of bytes.\n//  - fPort contains the LoRaWAN fPort number\n//  - obj is an object, e.g. {\"temperature\": 22.5}\n// The function must return an array of bytes, e.g. [225, 230, 255, 0]\nfunction Encode(fPort, obj) {\n\treturn [\n      obj[\"Flags\"],\n      obj[\"Battery\"],\n      obj[\"Light\"],\n    ];\n}\n"
  use_encoder = true
  max_exec_time = 500
  js_object = "{\n \"Flags\": 0,\n \"Battery\": 65,\n \"Light\": 54\n}"
  fport = 2

[[encoded_type]]
  name = "Flags"
  value = 5.0
  max_value = 255.0
  min_value = 0.0
  is_float = false
  num_bytes = 1

[[encoded_type]]
  name = "Batería"
  value = 80.0
  max_value = 255.0
  min_value = 0.0
  is_float = false
  num_bytes = 1

[[encoded_type]]
  name = "Luz"
  value = 50.0
  max_value = 255.0
  min_value = -0.0
  is_float = false
  num_bytes = 1

[redis]
  addr = "192.168.43.103:6379"
  password = ""
  db = 10
 

Thank you for your help

Hi,

I finally found the problem. If a decode function isn't added when we used this encoded data then the useful data doesn't show up.
Sorry for that I'm a newbie in this domain.
For those who aren't familiar with this domain like me, here's my decode function and my encoded data.

image
image

image

The results should appear in this JSON subpart :

image

Thanks for your help.

Great, thanks for the clarification!