How to configure [intergation.mqtt] configuration section

Viewed 14

Hi all,

Recently I would like to send gateway data to my application, which locates in another server with domain name (app.test).
Recently, devices data can be received, but gateway data can not.

I tried several methods in "chirpstack-gateway-bridge.toml", but they do not work well.

  1. Set [intergation.mqtt]

[integration.mqtt]
server="tcp://app.test:port"
event_topic_template="chirpstack/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
state_topic_template="chirpstack/gateway/{{ .GatewayID }}/state/{{ .StateType }}"

result: mqtt broker of app.test:port receives nothing

  1. Set [integration.mqtt.auth.generic]

[integration.mqtt]
event_topic_template="chirpstack/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
state_topic_template="chirpstack/gateway/{{ .GatewayID }}/state/{{ .StateType }}"

[integration.mqtt.auth.generic]
servers=["tcp://mosquitto:1883","tcp://app.test:port"]
username=""
password=""

result: local mosquitto can not receive data,
only app.test:port able to receive data, but the topic is not matched
topics become [region]/gateway/.....

  1. "chirpstack" prefix [integration.mqtt]

result: topic recieve in broker is still " [region]/gateway/..." , not "gateway/..."

My aim:
Sending gateway data to the mqtt broker in app.test:port, with prefix "chirpstack/gateway/..."

I also tried:
Set up a script to get and push received topic from mosquitto:1883 to app.test:port.
However only "[region]/gateway/..." works.

Does any developers had experience on this issue ?
Thank you.

1 Answers

Please note:

  1. The ChirpStack Gateway Bridge forwards gateway data only. In order to forward it to an application integration, know which device sent the data etc, it needs to pass ChirpStack first.
  2. ChirpStack v4 uses a region prefix (e.g. eu868, us915_0, ...), that must match the region configuration in the region_XXXXX.toml configuration file (e.g. for eu868: https://github.com/chirpstack/chirpstack/blob/master/chirpstack/configuration/region_eu868.toml#L47).
  3. For example for eu868, this would be the correct configuration:
event_topic_template="eu868/gateway/{{ .GatewayID }}/event/{{ .EventType }}"
state_topic_template="eu868/gateway/{{ .GatewayID }}/state/{{ .StateType }}"
command_topic_template="eu868/gateway/{{ .GatewayID }}/command/#"
  1. You can configure multiple MQTT servers, but the ChirpStack Gateway Bridge will only connect to one of these servers, e.g. the first it can connect to. I agree this is confusing and therefore, in the ChirpStack MQTT Forwarder the option to configure multiple servers was dropped (which is recommended over the Gateway Bridge if you install this on the gateway). So if you want to forward gateway data to app.test, this would be the correct config:
servers=["tcp://app.test:1883"]