iegomez / lds

Loraserver device simulator with a simple GUI.
43 stars 25 forks source link

Cannot join device simulator to ChirpStack via OTAA #33

Open LuighiV opened 3 years ago

LuighiV commented 3 years ago

I am trying to use your software to simulate a device connected to the ChirpStack platform I had deployed in a server. However, when I try to connect it, after sucessfully conected the MQTT client of your software, I had some error messages from the software.

The configuration file I use is:

encoded_type = []
log_level = ""

[mqtt]
  server = "tcp://192.168.27.51:1883"
  user = ""
  password = ""
  downlink_topic = "gateway/%s/command/down"
  uplink_topic = "gateway/%s/event/up"

[forwarder]
  nserver = ""
  nsport = ""

[band]
  name = "AU_915_928"

[device]
  eui = "0201010101010103"
  address = ""
  network_session_encription_key = ""
  serving_network_session_integrity_key = ""
  forwarding_network_session_integrity_key = ""
  application_session_key = ""
  marshaler = "json"
  nwk_key = ""
  app_key = "03010101010101010101010101010103"
  join_eui = "0000000000000000"
  mac_version = 0
  profile = "OTAA"
  joined = false
  skip_fcnt_check = false

[gateway]
  mac = "647fdafffe007f9f"
  bridge_version = ""

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

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

[raw_payload]
  payload = "DEEFF"
  use_raw = true
  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}\n"
  use_encoder = false
  max_exec_time = 100
  js_object = ""
  fport = 2

[redis]
  addr = ""
  password = ""
  db = 0

[provisioner]
  hostname = ""
  username = ""
  password = ""
  path = ""
  Token = ""

In the chirpstack server I got:

chirpstack-application-server_1  | time="2021-07-15T16:05:11Z" level=info msg="backend/joinserver: request received" message_type=JoinReq receiver_id=0000000000000000 sender_id=000000 transaction_id=4219271299
chirpstack-application-server_1  | time="2021-07-15T16:05:11Z" level=info msg="device-keys updated" ctx_id="<nil>" dev_eui=0201010101010103
chirpstack-application-server_1  | time="2021-07-15T16:05:11Z" level=info msg="backend/joinserver: sending response" dev_eui=0201010101010103 message_type=JoinAns receiver_id=000000 result_code=MICFailed sender_id=0000000000000000 transaction_id=4219271299
chirpstack-network-server_1      | time="2021-07-15T16:05:11Z" level=info msg="lorawan/backend: finished backend api call" message_type=JoinReq protocol_version=1.0 receiver_id=0000000000000000 result_code=MICFailed sender_id=000000 transaction_id=4219271299
chirpstack-application-server_1  | time="2021-07-15T16:05:11Z" level=error msg="join-server returned error: response error, code: MICFailed, description: invalid mic" dev_eui=0201010101010103 type=OTAA
chirpstack-application-server_1  | time="2021-07-15T16:05:11Z" level=info msg="finished unary call with code OK" ctx_id=5c998266-780a-4ddb-af4e-4aaee13a42be grpc.code=OK grpc.method=HandleError grpc.service=as.ApplicationServerService grpc.start_time="2021-07-15T16:05:11Z" grpc.time_ms=1.388 peer.address="172.18.0.10:36222" span.kind=server system=grpc
chirpstack-application-server_1  | time="2021-07-15T16:05:11Z" level=info msg="integration/logger: logging event" ctx_id=5c998266-780a-4ddb-af4e-4aaee13a42be dev_eui=0201010101010103 type=error
chirpstack-application-server_1  | time="2021-07-15T16:05:11Z" level=info msg="integration/mqtt: publishing event" ctx_id=5c998266-780a-4ddb-af4e-4aaee13a42be dev_eui=0201010101010103 qos=0 retain=false topic=application/1/device/0201010101010103/event/error
chirpstack-network-server_1      | time="2021-07-15T16:05:11Z" level=info msg="finished client unary call" ctx_id=106d5046-94db-4c0a-a165-fbe9982d27c4 grpc.code=OK grpc.ctx_id=5c998266-780a-4ddb-af4e-4aaee13a42be grpc.duration=1.867165ms grpc.method=HandleError grpc.service=as.ApplicationServerService span.kind=client system=grpc
chirpstack-network-server_1      | time="2021-07-15T16:05:11Z" level=error msg="uplink: processing uplink frame error" ctx_id=106d5046-94db-4c0a-a165-fbe9982d27c4 error="join-request to join-server error: response error, code: MICFailed, description: invalid mic"

In the debug messages from the app:

time="2021-07-15T11:24:57-05:00" level=debug msg="Incoming Downlink len=235"
time="2021-07-15T11:24:57-05:00" level=debug msg="original dlmessage: \n\x16`\x1c\xa5o\x00\xaa|\xc7\x03\x00\x00\x00p\x03P\xff\xff\x01 J\xf5\x1a\x12/\n\bd\u007f\xda\xff\xfe\x00\u007f\x9f(\xa0ᡸ\x030\x1b`\x01\x82\x01\x04\x01\x02\x03\x04B\f\b\xf4\x03\x10\a\x1a\x034/5 \x01r\x04\n\x02\b\x01\x18\x83\xaf\x01\"\x10W\x83Km\x03\xfeF\f\xa2\xe3\xe6X\xe3\xf0\x1cU*?\n\x16`\x1c\xa5o\x00\xaa|\xc7\x03\x00\x00\x00p\x03P\xff\xff\x01 J\xf5\x1a\x12%(\xa0ᡸ\x030\x1b`\x01\x82\x01\x04\x01\x02\x03\x04B\f\b\xf4\x03\x10\a\x1a\x034/5 \x01r\x04\n\x02\b\x01*?\n\x16`\x1c\xa5o\x00\xaa|\xc7\x03\x00\x00\x00p\x03P\xff\xff\x01 J\xf5\x1a\x12%(\xa0ᡸ\x030\x1b`\x01\x82\x01\x04\x01\x02\x03\x04B\f\b\xf4\x03\x10\f\x1a\x034/5 \x01r\x04\n\x02\b\x022\bd\u007f\xda\xff\xfe\x00\u007f\x9f"
time="2021-07-15T11:24:57-05:00" level=error msg="downlink error: invalid character '\\x16' looking for beginning of value"
time="2021-07-15T11:24:57-05:00" level=warning msg="[redis] missing ulFcnt key: dial tcp [::1]:6379: connect: connection refused"
time="2021-07-15T11:24:57-05:00" level=warning msg="[redis] missing dlFcnt key: dial tcp [::1]:6379: connect: connection refused"
time="2021-07-15T11:24:57-05:00" level=warning msg="[redis] missing join nonce key: dial tcp [::1]:6379: connect: connection refused"
time="2021-07-15T11:24:57-05:00" level=warning msg="[redis] missing dev nonce key: dial tcp [::1]:6379: connect: connection refused"
time="2021-07-15T11:24:57-05:00" level=error msg="redis convert error (fNwksSIntKey): dial tcp [::1]:6379: connect: connection refused"

In the ChirpStack aplication server there is a device with the EUI: 0201010101010103 with AppKey 03010101010101010101010101010103

Could you please, help me with this setting.

iegomez commented 3 years ago

Hi, @LuighiV. I'm no longer maintaining this repo, @scartill is, so maybe he could give you a hand. Actually, I tried transferring ownership of it to him some time ago, not sure what went wrong. 🤔

LuighiV commented 3 years ago

Hi @iegomez, thanks for your answer. Hope @scartill could help me with this.

scartill commented 3 years ago

Hi @LuighiV

Thank you for posting. I'll take a look a.s.a.p.