Configuration

To list all CLI options, start chirpstack-mqtt-forwarder with the --help flag. This will print:

ChirpStack MQTT Forwarder

Usage: chirpstack-mqtt-forwarder [OPTIONS] [COMMAND]

Commands:
  configfile  Print the configuration template
  help        Print this message or the help of the given subcommand(s)

Options:
  -c, --config <FILE>  
  -h, --help           Print help information
  -V, --version        Print version information

Configuration example

Example chirpstack-mqtt-forwarder.toml configuration:



# Logging settings.
[logging]

  # Log level.
  #
  # Valid options are:
  #   * TRACE
  #   * DEBUG
  #   * INFO
  #   * WARN
  #   * ERROR
  #   * OFF
  level="info"

  # Log to syslog.
  #
  # If set to true, log messages are being written to syslog instead of stdout.
  log_to_syslog=false


# MQTT settings.
[mqtt]

  # Topic prefix.
  #
  # ChirpStack MQTT Forwarder publishes to the following topics:
  #
  #  * [Prefix/]gateway/[Gateway ID]/event/[Event]
  #  * [Prefix/]gateway/[Gateway ID]/state/[State]
  #
  # And subscribes to the following topic:
  #
  #  * [Prefix/]gateway/[Gateway ID]/command/[Command]
  #
  # The topic prefix can be used to define the region of the gateway.
  # Note, there is no need to add a trailing '/' to the prefix. The trailing
  # '/' is automatically added to the prefix if it is configured.
  topic_prefix="eu868"

  # Use JSON encoding instead of Protobuf (binary).
  #
  # Note, only use this for debugging purposes.
  json=false

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

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

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

  # 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=""


# Backend configuration.
[backend]

  # Enabled backend.
  #
  # Set this to the backend that must be used by the ChirpStack MQTT Forwarder.
  # Valid options are:
  #   * concentratord
  #   * semtech_udp
  enabled="semtech_udp"

  # Filters.
  [backend.filters]

    # Forward CRC ok.
    forward_crc_ok=true

    # Forward CRC invalid.
    forward_crc_invalid=false

    # Forward CRC missing.
    forward_crc_missing=false

    # DevAddr prefix filters.
    #
    # Example configuration:
    # dev_addr_prefixes=["0000ff00/24"]
    #
    # The above filter means that the 24MSB of 0000ff00 will be used to
    # filter DevAddrs. Uplinks with DevAddrs that do not match any of the
    # configured filters will not be forwarded. Leaving this option empty
    # disables filtering on DevAddr.
    dev_addr_prefixes=[
    ]

    # JoinEUI prefix filters.
    #
    # Example configuration:
    # join_eui_prefixes=["0000ff0000000000/24"]
    #
    # The above filter means that the 24MSB of 0000ff0000000000 will be used
    # to filter JoinEUIs. Uplinks with JoinEUIs that do not match any of the
    # configured filters will not be forwarded. Leaving this option empty
    # disables filtering on JoinEUI.
    join_eui_prefixes=[
    ]


  # ChirpStack Concentratord backend configuration.
  [backend.concentratord]

    # Event API URL.
    event_url="ipc:///tmp/concentratord_event"

    # Command API URL.
    command_url="ipc:///tmp/concentratord_command"


  # Semtech UDP backend configuration.
  [backend.semtech_udp]

    # ip:port to bind the UDP listener to.
    #
    # Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
    # This is the listener to which the packet-forwarder forwards its data
    # so make sure the 'serv_port_up' and 'serv_port_down' from your
    # packet-forwarder matches this port.
    bind="0.0.0.0:1700"

    # Time fallback.
    #
    # In case the UDP packet-forwarder does not set the 'time' field, then the
    # server-time will be used as fallback if this option is enabled.
    time_fallback_enabled=false


# Gateway metadata configuration.
[metadata]

  # Static key / value metadata.
  [metadata.static]
      
    # Example:
    # serial_number="1234"


  # Commands returning metadata.
  [metadata.commands]

    # Example:
    # datetime=["date", "-R"]


# Executable commands.
[commands]

  # Example:
  # reboot=["/usr/bin/reboot"]