Connecting to backend mqqt broker

I run Chirpstack V3 and have just built a new V4 instance in its own Ubuntu VM. Install went OK and I can connect my rak gateway to Chirpstack (configured as basic station) and sensors send data to chirpstack. no issues.

However I am at a loss as to where I enter the mqtt config so sensor data is sent to my backend mqtt server. In V3 this was in the chirpstack-application-server.toml file , where is the equivalent V4 config file?

I have tried changing the mqtt integration section in /etc/chirpstack/chirpstack.toml file but this just stops the main chirpstack dashboard page from starting.

Help much appreciated.

Should be this part (from Configuration - ChirpStack open-source LoRaWAN® Network Server documentation):

    # Generic MQTT authentication.
    [integration.mqtt.auth.generic]
    # MQTT servers.
    #
    # Configure one or multiple MQTT server to connect to. Each item must be in
    # the following format: scheme://host:port where scheme is tcp, ssl or ws.
    servers=[
      "tcp://127.0.0.1:1883",
    ]

Details would depend on on security that your mosquitto broker uses (like user, password, certificates if used etc).

thanks but changing the mqtt settings in the gateway-bridge only provides mqtt gateway topics, I want the application topics. How do I get the application topics sent?

I see application topics and mqtt integration in the chirpstack.toml file and the architecture implies this is where I need to change things, but when I set it here I see nothing transmitted over mqtt from chirpstack.

still scratching my head and any comments/direction welcome
scratching my head

Ah, sorry, whong link. App server config is not much different tho: Configuration - ChirpStack open-source LoRaWAN® Network Server documentation

# MQTT integration configuration.
  [integration.mqtt]
# Event topic template.
    event_topic="application/{{application_id}}/device/{{dev_eui}}/event/{{event}}"

    # Command topic.
    # This is the topic on which the MQTT subscribes for receiving (enqueue) commands.
    command_topic="application/{{application_id}}/device/{{dev_eui}}/command/{{command}}"

    # Use JSON encoding instead of Protobuf (binary).
    json=true

    # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
    server="tcp://127.0.0.1:1883/"

If it does not work for you, then check ussual (start with mosquitto logs, netstat, check network settings, firewall etc…)

1 Like

Thanks for your direction but I am still having issues in getting Chirpstack to send application topics to my external broker.

When I modify chirpstack.toml (see below) Chirpstack does not appear to make a connection to my external broker, I have checked the chirpstack and mosquitto logs but can see no error message. I have shown below the chirpstack.toml log showing when a client join request is made to see if this sheds any light on the problem.

If I modify the chirpstack-gateway-bridge.toml with my mqtt credentials I do see and receive published topics.

I am obviously doing something wrong, your help really appreciated.

# Logging.
[logging]

  # Log level.
  #
  # Options are: trace, debug, info, warn error.
  level="info"


# PostgreSQL configuration.
[postgresql]

  # PostgreSQL DSN.
  #
  # Format example: postgres://<USERNAME>:<PASSWORD>@<HOSTNAME>/<DATABASE>?sslmode=<SSLMODE>.
  #
  # SSL mode options:
  #  * disable - no SSL
  #  * require - Always SSL (skip verification)
  #  * verify-ca - Always SSL (verify that the certificate presented by the server was signed by a trusted CA)
  #  * verify-full - Always SSL (verify that the certification presented by the server was signed by a trusted CA and the server host name matches the one in the certificate)
  dsn="postgres://chirpstack:chirpstack@localhost/chirpstack?sslmode=disable"

  # Max open connections.
  #
  # This sets the max. number of open connections that are allowed in the
  # PostgreSQL connection pool.
  max_open_connections=10

  # Min idle connections.
  #
  # This sets the min. number of idle connections in the PostgreSQL connection
  # pool (0 = equal to max_open_connections).
  min_idle_connections=0


# Redis configuration.
[redis]

  # Server address or addresses.
  #
  # Set multiple addresses when connecting to a cluster.
  servers=[
    "redis://localhost/",
  ]

  # TLS enabled.
  tls_enabled=false

  # Redis Cluster.
  #
  # Set this to true when the provided URLs are pointing to a Redis Cluster
  # instance.
  cluster=false


# Network related configuration.
[network]

  # Network identifier (NetID, 3 bytes) encoded as HEX (e.g. 010203).
  net_id="000000"

  # Enabled regions.
  #
  # Multiple regions can be enabled simultaneously. Each region must match
  # the 'name' parameter of the region configuration in '[[regions]]'.
  enabled_regions=[
    "as923",
    "as923_2",
    "as923_3",
    "as923_4",
    "au915_0",
    "cn470_10",
    "cn779",
    "eu433",
    "eu868",
    "in865",
    "ism2400",
    "kr920",
    "ru864",
    "us915_0",
    "us915_1",
  ]


# API interface configuration.
[api]

  # interface:port to bind the API interface to.
  bind="0.0.0.0:8080"

  # Secret.
  #
  # This secret is used for generating login and API tokens, make sure this
  # is never exposed. Changing this secret will invalidate all login and API
  # tokens. The following command can be used to generate a random secret:
  #   openssl rand -base64 32
  secret="mysecret"

# Global integration related configuration.
[integration]

  # Enabled integrations (global).
  enabled = [
  ]

  # MQTT integration configuration.
  [integration.mqtt]

    # Event topic template.
    event_topic="application/{{application_id}}/device/{{dev_eui}}/event/{{event}}"

    # Command topic.
    #
    # This is the topic on which the MQTT subscribes for receiving (enqueue) commands.
    command_topic="application/{{application_id}}/device/{{dev_eui}}/command/{{command}}"

    # Use JSON encoding instead of Protobuf (binary).
    json=true

    # MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
    server="tcp://192.168.1.33:1883/"

    # Connect with the given username (optional)
    username="uuuuu"

    # Connect with the given password (optional)
    password="ppppp"

    # Quality of service level
    #
    # 0: at most once
    # 1: at least once
    # 2: exactly once
    #
    # Note: an increase of this value will decrease the performance.
    # For more information: https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels
    qos=0

    # Clean session
    #
    # Set the "clean session" flag in the connect message when this client
    # connects to an MQTT broker. By setting this flag you are indicating
    # that no messages saved by the broker for this client should be delivered.
    clean_session=false

    # Client ID
    #
    # Set the client id to be used by this client when connecting to the MQTT
    # broker. A client id must be no longer than 23 characters. If left blank,
    # a random id will be generated by ChirpStack.
    client_id=""

    # CA certificate file (optional)
    #
    # Use this when setting up a secure connection (when server uses ssl://...)
    # but the certificate used by the server is not trusted by any CA certificate
    # on the server (e.g. when self generated).
    ca_cert=""

    # TLS certificate file (optional)
    tls_cert=""

    # TLS key file (optional)
    tls_key=""

Chirpstack.toml log

Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.291333Z  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="eu868" topic="eu868/gateway/ac1f09fffe0b8059/event/up" qos=0 json=true
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.493809Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}: chirpstack::uplink: Uplink received m_type="JoinRequest"
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.500067Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}:join_request: chirpstack::storage::device_keys: Device-nonce validated and stored dev_eui=a84041127184582b dev_nonce=56553
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.502374Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}:join_request: chirpstack::storage::device_keys: Device-keys updated dev_eui=a84041127184582b
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.502977Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}:join_request: chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.503442Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}:join_request: chirpstack::storage::device_queue: Device queue flushed dev_eui=a84041127184582b count=0
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.505671Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}:join_request: chirpstack::storage::device: Enabled class updated dev_eui=a84041127184582b enabled_class=A
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.506053Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}:join_request: chirpstack::gateway::backend::mqtt: Sending downlink frame gateway_id=ac1f09fffe0b8059 topic=eu868/gateway/ac1f09fffe0b8059/command/down json=true
Nov 24 15:48:15 chirpstack chirpstack[629]: 2022-11-24T15:48:15.506501Z  INFO up{deduplication_id=b4d06043-75c8-49d1-805b-1e2ba6eb76ec}:join_request: chirpstack::storage::downlink_frame: Downlink-frame saved downlink_id=666988886
Nov 24 15:48:20 chirpstack chirpstack[629]: 2022-11-24T15:48:20.296523Z  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="eu868" topic="eu868/gateway/ac1f09fffe0b8059/event/ack" qos=0 json=true
Nov 24 15:48:20 chirpstack chirpstack[629]: 2022-11-24T15:48:20.297122Z  INFO chirpstack::downlink::tx_ack: Log downlink-frame for gateway gateway_id=ac1f09fffe0b8059
Nov 24 15:48:20 chirpstack chirpstack[629]: 2022-11-24T15:48:20.297429Z  INFO chirpstack::downlink::tx_ack: Log downlink-frame for device device_eui=a84041127184582b
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.398928Z  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="eu868" topic="eu868/gateway/ac1f09fffe0b8059/event/up" qos=0 json=true
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.601224Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}: chirpstack::uplink: Uplink received m_type="UnconfirmedDataUp"
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.602897Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.604811Z  INFO chirpstack::storage::device: Setting device lock dev_eui=a84041127184582b
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.609956Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::device: Data-rate updated dev_eui=a84041127184582b dr=0
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.610525Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::maccommand::device_time: DeviceTimeReq received dev_eui=a84041127184582b rx_time=2022-11-24 15:48:22.316859 UTC gps_time=1353340120
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.610932Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::device_gateway: Gateway rx-info saved dev_eui=a84041127184582b
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.616106Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.616469Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::metrics: Metrics saved name=device:a84041127184582b aggregation=HOUR
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.616692Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::metrics: Metrics saved name=device:a84041127184582b aggregation=DAY
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.616925Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::metrics: Metrics saved name=device:a84041127184582b aggregation=MONTH
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.617617Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::mac_command: Pending mac-command block set dev_eui=a84041127184582b cid=LinkADRReq
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.618035Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::downlink_frame: Downlink-frame saved downlink_id=2877018956
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.618293Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:22 chirpstack chirpstack[629]: 2022-11-24T15:48:22.618434Z  INFO up{deduplication_id=6cdbe526-c222-439a-89d8-8a2a269b5881}:data_up: chirpstack::gateway::backend::mqtt: Sending downlink frame gateway_id=ac1f09fffe0b8059 topic=eu868/gateway/ac1f09fffe0b8059/command/down json=true
Nov 24 15:48:23 chirpstack chirpstack[629]: 2022-11-24T15:48:23.400451Z  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="eu868" topic="eu868/gateway/ac1f09fffe0b8059/event/ack" qos=0 json=true
Nov 24 15:48:23 chirpstack chirpstack[629]: 2022-11-24T15:48:23.401260Z  INFO chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:23 chirpstack chirpstack[629]: 2022-11-24T15:48:23.401430Z  INFO chirpstack::downlink::tx_ack: Log downlink-frame for gateway gateway_id=ac1f09fffe0b8059
Nov 24 15:48:23 chirpstack chirpstack[629]: 2022-11-24T15:48:23.401685Z  INFO chirpstack::downlink::tx_ack: Log downlink-frame for device device_eui=a84041127184582b
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.102145Z  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="eu868" topic="eu868/gateway/ac1f09fffe0b8059/event/up" qos=0 json=true
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.304334Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}: chirpstack::uplink: Uplink received m_type="UnconfirmedDataUp"
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.306404Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.307221Z  INFO chirpstack::storage::device: Setting device lock dev_eui=a84041127184582b
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.309486Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::device: Data-rate updated dev_eui=a84041127184582b dr=5
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.310221Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::mac_command: Pending mac-command block deleted dev_eui=a84041127184582b cid=LinkADRAns
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.310446Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::maccommand::link_adr: LinkADRReq acknowledged dev_eui=a84041127184582b tx_power_index=2 dr=5 nb_trans=1 enabled_channels=[0, 1, 2, 3, 4, 5, 6, 7]
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.310646Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::maccommand::dev_status: DevStatusAns received dev_eui=a84041127184582b battery=100 margin=4
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.314978Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::device: Device status updated dev_eui=a84041127184582b
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.315752Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::device_gateway: Gateway rx-info saved dev_eui=a84041127184582b
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.320515Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.320934Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::metrics: Metrics saved name=device:a84041127184582b aggregation=HOUR
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.321167Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::metrics: Metrics saved name=device:a84041127184582b aggregation=DAY
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.321419Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::metrics: Metrics saved name=device:a84041127184582b aggregation=MONTH
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.321851Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::mac_command: Pending mac-command block set dev_eui=a84041127184582b cid=LinkADRReq
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.322059Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::downlink_frame: Downlink-frame saved downlink_id=25356217
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.322337Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:25 chirpstack chirpstack[629]: 2022-11-24T15:48:25.322464Z  INFO up{deduplication_id=5060ae15-00ba-445c-ac6f-6fa45b4f07b0}:data_up: chirpstack::gateway::backend::mqtt: Sending downlink frame gateway_id=ac1f09fffe0b8059 topic=eu868/gateway/ac1f09fffe0b8059/command/down json=true
Nov 24 15:48:27 chirpstack chirpstack[629]: 2022-11-24T15:48:27.104201Z  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="eu868" topic="eu868/gateway/ac1f09fffe0b8059/event/ack" qos=0 json=true
Nov 24 15:48:27 chirpstack chirpstack[629]: 2022-11-24T15:48:27.104917Z  INFO chirpstack::storage::device_session: Device-session saved dev_eui=a84041127184582b dev_addr=0154116d
Nov 24 15:48:27 chirpstack chirpstack[629]: 2022-11-24T15:48:27.105018Z  INFO chirpstack::downlink::tx_ack: Log downlink-frame for gateway gateway_id=ac1f09fffe0b8059
Nov 24 15:48:27 chirpstack chirpstack[629]: 2022-11-24T15:48:27.105303Z  INFO chirpstack::downlink::tx_ack: Log downlink-frame for device device_eui=a84041127184582b
Nov 24 15:48:31 chirpstack chirpstack[629]: 2022-11-24T15:48:31.308380Z  INFO chirpstack::gateway::backend::mqtt: Message received from gateway region_name="eu868" topic="eu868/gateway/ac1f09fffe0b8059/event/stats" qos=0 json=true
Nov 24 15:48:31 chirpstack chirpstack[629]: 2022-11-24T15:48:31.311100Z  INFO stats{gateway_id=ac1f09fffe0b8059}: chirpstack::storage::gateway: Gateway state updated gateway_id=ac1f09fffe0b8059
Nov 24 15:

Mqtt config seems ok, you just need to enable selected intergrations too:

# Global integration related configuration.
[integration]

  # Enabled integrations (global).
  enabled = [
    "mqtt",
  ]

  # MQTT integration configuration.
  [integration.mqtt]
1 Like

Thanks. BTW love the payload decoder integration from TTN.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.