RAKWireless / udp-packet-forwarder

UDP Packet Forwarder for Docker
MIT License
25 stars 21 forks source link

no data in rabbitmq #4

Closed chaudhariatul closed 1 year ago

chaudhariatul commented 1 year ago

Hello,

This is my setup:

chirpstack-gateway-bridge

cat docker-compose.yml

version: '3.6'
networks:
  loranet:
    external: true
services:
  chirpstack-gateway-bridge:
    image: chirpstack/chirpstack-gateway-bridge:3.14.0
    container_name: gatewaybridge
    hostname: gatewaybridge
    restart: always
    logging:
      options:
        max-size: "10m"
        max-file: "3"
    ports:
      - "1700:1700/udp"
    volumes:
      - ./chirpstack-gateway-bridge.toml:/etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge.toml
    networks:
      loranet:

udp-packet-forwarder

cat docker-compose.yml

version: '3.6'
networks:
  loranet:
    external: true
services:
  udp-packet-forwarder:
    image: rakwireless/udp-packet-forwarder:v1.1.3
    container_name: udpforwarder
    hostname: udpforwarder
    restart: always
    logging:
      options:
        max-size: "10m"
        max-file: "3"
    privileged: true
    volumes:
      - ./global_conf.json:/app/global_conf.json:ro
    environment:
      MODEL: "RAK7371"
      MODULE: "RAK5146"
      CONCENTRATOR: "SX1303"
      HAS_GPS: "0"
      INTERFACE: "USB"
      GATEWAY_EUI: "26E804FFFE7093C0"
      SERVER_HOST: "gatewaybridge.loranet"
      SERVER_PORT: "1700"
      RADIO_DEV: "/dev/ttyACM0"
      GATEWAY_EUI_NIC: "usb0"
      BAND: "us_902_928"
    networks:
      loranet:

RabbitMQ mqtt plugin is enabled, where I see the connection established from chirpstack-gateway-bridge container. A queue is created mqtt-subscription-66C0A7FC63D30000qos0 which confirms successful creation of all the containers.

But when I send data from lora devices I do not see any data received by chirpstack-gateway-bridge or rabbitmq

xoseperez commented 1 year ago

Can you check the logs at the UDP packet forwarder conainer? Is it receiving the messages?

I guess the server configuration is right and the chirpstack-gateway-bridge is reacheable from the udp packet forwarder at gatewaybridge.loranet:1700, but since they are in the same network you can also try gatewaybridge:1700

chaudhariatul commented 1 year ago

Yes, logs are inline below. When I use mqtt-explorer client it shows the data but nothing persists in RabbitMQ.

udp-packet-forwarder docker logs

JSON up: {"rxpk":[{"jver":1,"tmst":516259720,"chan":0,"rfch":0,"freq":903.900000,"mid": 8,"stat":1,"modu":"LORA","datr":"SF10BW125","codr":"4/5","rssis":-33,"lsnr":12.8,"foff":140,"rssi":-33,"size":19,"data":"QGwIAEiAMgAC2umcXqTCSN9dwA=="}]}
INFO: [up] PUSH_ACK received in 1 ms
INFO: [down] PULL_ACK received in 0 ms
INFO: [down] PULL_ACK received in 0 ms

INFO: Received pkt from mote: 4800086C (fcnt=51)

JSON up: {"rxpk":[{"jver":1,"tmst":536259394,"chan":6,"rfch":1,"freq":905.100000,"mid": 8,"stat":1,"modu":"LORA","datr":"SF10BW125","codr":"4/5","rssis":-31,"lsnr":14.5,"foff":144,"rssi":-31,"size":19,"data":"QGwIAEiAMwACFJhLSo74gxmR6g=="}]}
INFO: [up] PUSH_ACK received in 1 ms
INFO: [down] PULL_ACK received in 0 ms

##### 2022-07-19 23:33:58 GMT #####
### [UPSTREAM] ###
# RF packets received by concentrator: 2
# CRC_OK: 100.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
# RF packets forwarded: 2 (38 bytes)
# PUSH_DATA datagrams sent: 3 (656 bytes)
# PUSH_DATA acknowledged: 100.00%
### [DOWNSTREAM] ###
# PULL_DATA sent: 3 (100.00% acknowledged)
# PULL_RESP(onse) datagrams received: 0 (0 bytes)
# RF packets sent to concentrator: 0 (0 bytes)
# TX errors: 0
### SX1302 Status ###
# SX1302 counter (INST): 540833080
# SX1302 counter (PPS):  0
# BEACON queued: 0
# BEACON sent so far: 0
# BEACON rejected: 0
### [JIT] ###
src/jitqueue.c:440:jit_print_queue(): INFO: [jit] queue is empty
#--------
src/jitqueue.c:440:jit_print_queue(): INFO: [jit] queue is empty
### [GPS] ###
# Invalid time reference (age: 1658273638 sec)
# no valid GPS coordinates available yet
##### END #####

JSON up: {"stat":{"time":"2022-07-19 23:33:58 GMT","lati":23.99595,"long":-103.12665,"alti":0,"rxnb":2,"rxok":2,"rxfw":2,"ackr":100.0,"dwnb":0,"txnb":0,"temp":29.6}}
INFO: [up] PUSH_ACK received in 1 ms
INFO: [down] PULL_ACK received in 0 ms

INFO: Received pkt from mote: 4800086C (fcnt=52)

JSON up: {"rxpk":[{"jver":1,"tmst":556258129,"chan":4,"rfch":1,"freq":904.700000,"mid": 9,"stat":1,"modu":"LORA","datr":"SF10BW125","codr":"4/5","rssis":-33,"lsnr":13.2,"foff":141,"rssi":-32,"size":19,"data":"QGwIAEiANAACRsm988NsKGMCmg=="}]}
INFO: [up] PUSH_ACK received in 0 ms
INFO: [down] PULL_ACK received in 0 ms
INFO: [down] PULL_ACK received in 0 ms

##### 2022-07-19 23:34:28 GMT #####
### [UPSTREAM] ###
# RF packets received by concentrator: 1
# CRC_OK: 100.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
# RF packets forwarded: 1 (19 bytes)
# PUSH_DATA datagrams sent: 2 (412 bytes)
# PUSH_DATA acknowledged: 100.00%
### [DOWNSTREAM] ###
# PULL_DATA sent: 3 (100.00% acknowledged)
# PULL_RESP(onse) datagrams received: 0 (0 bytes)
# RF packets sent to concentrator: 0 (0 bytes)
# TX errors: 0
### SX1302 Status ###
# SX1302 counter (INST): 570834526
# SX1302 counter (PPS):  0
# BEACON queued: 0
# BEACON sent so far: 0
# BEACON rejected: 0
### [JIT] ###
src/jitqueue.c:440:jit_print_queue(): INFO: [jit] queue is empty
#--------
src/jitqueue.c:440:jit_print_queue(): INFO: [jit] queue is empty
### [GPS] ###
# Invalid time reference (age: 1658273668 sec)
# no valid GPS coordinates available yet
##### END #####

JSON up: {"stat":{"time":"2022-07-19 23:34:28 GMT","lati":23.99595,"long":-103.12665,"alti":0,"rxnb":1,"rxok":1,"rxfw":1,"ackr":100.0,"dwnb":0,"txnb":0,"temp":29.6}}
INFO: [up] PUSH_ACK received in 0 ms
ERROR: wrong coding rate (0) - timestamp_counter_correction

INFO: Received pkt from mote: 4800086C (fcnt=53)

JSON up: {"rxpk":[{"jver":1,"tmst":576258777,"chan":2,"rfch":0,"freq":904.300000,"mid": 8,"stat":1,"modu":"LORA","datr":"SF10BW125","codr":"4/5","rssis":-33,"lsnr":9.2,"foff":144,"rssi":-33,"size":19,"data":"QGwIAEiANQAC1mUlPNEs0/V0rA=="}]}
INFO: [up] PUSH_ACK received in 0 ms
INFO: [down] PULL_ACK received in 0 ms
INFO: [down] PULL_ACK received in 0 ms

INFO: Received pkt from mote: 4800086C (fcnt=54)

JSON up: {"rxpk":[{"jver":1,"tmst":596259419,"chan":5,"rfch":1,"freq":904.900000,"mid": 9,"stat":1,"modu":"LORA","datr":"SF10BW125","codr":"4/5","rssis":-46,"lsnr":12.5,"foff":140,"rssi":-46,"size":19,"data":"QGwIAEiANgACSLljynfEB0YT8g=="}]}
INFO: [up] PUSH_ACK received in 0 ms

Gateway bridge docker logs

time="2022-07-19T23:34:14.109669444Z" level=info msg="integration/mqtt: publishing event" event=up qos=1 topic=gateway/66c0a7fc63d30000/event/up uplink_id=8edd1c5d-1c4e-45bf-8bb4-096f5756bf5e
time="2022-07-19T23:34:28.683682628Z" level=info msg="integration/mqtt: publishing event" event=stats qos=1 stats_id=bfbf277a-f731-4206-bd50-6eae89a94020 topic=gateway/66c0a7fc63d30000/event/stats
time="2022-07-19T23:34:34.107818012Z" level=info msg="integration/mqtt: publishing event" event=up qos=1 topic=gateway/66c0a7fc63d30000/event/up uplink_id=cbfda073-0f29-47f6-a8eb-8ee396817f21
time="2022-07-19T23:34:54.111437729Z" level=info msg="integration/mqtt: publishing event" event=up qos=1 topic=gateway/66c0a7fc63d30000/event/up uplink_id=c864f139-156b-44c5-bae6-1b93d90cdfbb
time="2022-07-19T23:34:58.677749907Z" level=info msg="integration/mqtt: publishing event" event=stats qos=1 stats_id=33e9a53c-81bc-410f-b1df-579ae5832e42 topic=gateway/66c0a7fc63d30000/event/stats
{
  "phyPayload": "QGwIAEiANAACRsm988NsKGMCmg==",
  "txInfo": {
    "frequency": 904700000,
    "modulation": "LORA",
    "loRaModulationInfo": {
      "bandwidth": 125,
      "spreadingFactor": 10,
      "codeRate": "4/5",
      "polarizationInversion": false
    }
  },
  "rxInfo": {
    "gatewayID": "ZsCn/GPTAAA=",
    "time": null,
    "timeSinceGPSEpoch": null,
    "rssi": -32,
    "loRaSNR": 13.2,
    "channel": 4,
    "rfChain": 1,
    "board": 0,
    "antenna": 0,
    "location": null,
    "fineTimestampType": "NONE",
    "context": "ISfTUQ==",
    "uplinkID": "jt0cXRxORb+LtAlvV1a/Xg==",
    "crcStatus": "CRC_OK"
  }
}

{
  "phyPayload": "QGwIAEiANQAC1mUlPNEs0/V0rA==",
  "txInfo": {
    "frequency": 904300000,
    "modulation": "LORA",
    "loRaModulationInfo": {
      "bandwidth": 125,
      "spreadingFactor": 10,
      "codeRate": "4/5",
      "polarizationInversion": false
    }
  },
  "rxInfo": {
    "gatewayID": "ZsCn/GPTAAA=",
    "time": null,
    "timeSinceGPSEpoch": null,
    "rssi": -33,
    "loRaSNR": 9.2,
    "channel": 2,
    "rfChain": 0,
    "board": 0,
    "antenna": 0,
    "location": null,
    "fineTimestampType": "NONE",
    "context": "IlkC2Q==",
    "uplinkID": "y/2gcw8pR/ao647jloF/IQ==",
    "crcStatus": "CRC_OK"
  }
}
chaudhariatul commented 1 year ago

Binding amp.topic with this routing key gateway.*.*.* helped fix the issue.

{"gatewayID":"ZsCn/GPTAAA=","state":"ONLINE"}