Hi,
I am encountering an issue with my devices that are connected to Chirpstack and NodeRed on an AWS EC2 instance using RFM95. All data is stored in AWS IoT Core.
The problem I am experiencing is that NodeRed is processing uplinks twice, resulting in double downlinks. This is causing the device queue to fill with packets that will never be sent, causing the device to receive old data.
After using mosquitto_sub in my EC2 instance, I discovered that the topics gateway/+/event/up and application/+/device/+/event/up are being duplicated when a message is received. The delay between duplicated messages is short (around 40-50ms).
I activated the frame counter of the device at chirpstack, but I believe this is not the issue since I am only using one gateway for testing purposes.
I have made changes in the chirpstack-network-server.toml file to increase the RX1 delay to 5 seconds to avoid missing packets due to lack of gateway connectivity (the gateways will be used in farms with low connectivity). After making this change, I believe I have enough time to process the uplink and send a downlink with the updated changes before the time of the RX1 delay is reached so I expect that the downlink with the response would not sent after the next uplink (if the queue remains empty).
I have checked and the delay between an uplink and downlink is less than 400ms (NodeRed + AWS IoT core).
Therefore, I have configured the .toml file accordingly:
Network-server settings.
[network_server]
Network identifier (NetID, 3 bytes) encoded as HEX (e.g. 010203)
net_id=“000000”
Time to wait for uplink de-duplication.
deduplication_delay=“400ms”
Device session expiration.
device_session_ttl=“744h0m0s”
Get downlink data delay.
get_downlink_data_delay=“1000ms”
LoRaWAN regional band configuration.
[network_server.band]
name=“AU915”
Enforce 400ms dwell time.
uplink_dwell_time_400ms=false
downlink_dwell_time_400ms=false
Uplink max. EIRP.
uplink_max_eirp=-1
Enforce repeater compatibility.
repeater_compatible=false
LoRaWAN network related settings.
[network_server.network_settings]
Installation margin (dB) used by the ADR engine.
installation_margin=10
RX window (Class-A).
Set this to:
0: RX1 / RX2
1: RX1 only
2: RX2 only
rx_window=0
Class A RX1 delay
0=1sec, 1=1sec, … 15=15sec.
rx1_delay=5
RX1 data-rate offset
rx1_dr_offset=0
RX2 data-rate
When set to -1, the default RX2 data-rate will be used for the configured
rx2_dr=-1
RX2 frequency
When set to -1, the default RX2 frequency will be used.
rx2_frequency=-1
Prefer RX2 on RX1 data-rate less than.
rx2_prefer_on_rx1_dr_lt=0
Prefer RX2 on link budget.
rx2_prefer_on_link_budget=false
Prefer gateways for downlink with given uplink (SNR) margin.
gateway_prefer_min_margin=10
Downlink TX Power (dBm)
downlink_tx_power=-1
Disable mac-commands
disable_mac_commands=false
Disable ADR
disable_adr=false
Max mac-command error count.
max_mac_command_error_count=3
Enable only a given sub-set of channels
enabled_uplink_channels=[]
ADR plugins.
adr_plugins=[]
# Class B settings
[network_server.network_settings.class_b]
# Ping-slot data-rate.
ping_slot_dr=0
# Ping-slot frequency (Hz)
ping_slot_frequency=0
Network-server API
[network_server.api]
ip:port to bind the api server
bind=“0.0.0.0:8000”
Backend defines the gateway backend settings.
[network_server.gateway.backend]
Backend
type=“mqtt”
# MQTT gateway backend settings.
#
# This is the backend communicating with the LoRa gateways over a MQTT broker.
[network_server.gateway.backend.mqtt]
# MQTT topic templates for the different MQTT topics.
#
# The meaning of these topics are documented at:
# https://www.chirpstack.io/gateway-bridge/
#
# The default values match the default expected configuration of the
# ChirpStack Gateway Bridge MQTT backend. Therefore only change these values when
# absolutely needed.
# Event topic template.
event_topic="gateway/+/event/+"
# Command topic template.
#
# Use:
# * "{{ .GatewayID }}" as an substitution for the LoRa gateway ID
# * "{{ .CommandType }}" as an substitution for the command type
command_topic_template="gateway/{{ .GatewayID }}/command/{{ .CommandType }}"
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
server="tcp://localhost:1883"
Metrics collection settings.
[metrics]
Timezone
timezone=“Local”
Join-server settings.
[join_server]
Default join-server settings.
This join-server will be used when resolving the JoinEUI is set to false
or as a fallback when resolving the JoinEUI fails.
[join_server.default]
hostname:port of the default join-server
This API is provided by ChirpStack Application Server.
server=“http://localhost:8003”
Here there are some information of the live frames of a device and its queue:
On the live lora frames the duplication is not shown.
I’ve been trying to find the cause of the problem for a few days, please tell me if you see something weird in my setup.
Also, how can I get more information about how is originated the “gateway” topic to try find the cause of this?
Thanks!