Skip to content

Instantly share code, notes, and snippets.

Last active October 25, 2023 17:13
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Bridge Mosquitto MQTT broker to MQTT broker to use with
# Connection name
connection adafruit
# Secure SSL/TLS
# adjust path as approriate to point to directory with PEM encoded .crt CA files
bridge_capath /etc/ssl/certs/
# Insecure
# address
# Credentials
remote_username <your username>
remote_password <your aio key>
# Config options for bridge
start_type automatic
bridge_protocol_version mqttv311
# This is important, if set to True connection will fail,
# probably because users don't have permissions to $SYS/#
notifications false
# Also important. if set to True the connection will fail,
# it seems doesn't support this
try_private false
# Topics to bridge
# topic <local topic> <in|out|both> <QoS> <local topic prefix> <remote topic prefix>
# eg: bridge temperature/shed to temperature/shed
# topic temperature/shed out 0 "" ""
# eg: bridge to
# temperature/shed to <username>/feeds/temperature_shed
# topic shed out 0 temperature <username>/feeds/temperature_
# eg: bridge from
# <username>/feeds/throttle to
# topic throttle in 0 <username>/feeds/
# eg: bi-directional topic
# <username>/feeds/welcome-feed to/from
# topic welcome-feed both 0 <username>/feeds/
# note: if using the "Welcome Feed" you'll need to rename
# it to "welcome-feed" in the web interface for the above example to work
Copy link

Hey Troy,

Thanks for taking the time to share this mosquitto config. Has helped me immensely.

I've forked your config file, and updated line 10 to add a space between the hash and the keyword address. I got a config file syntax error on that line when I attempted to start Mosquitto.

Seems Mosquitto expects comments to begin #(whitespace)

I've also added to my fork, instructions for CA config on RHEL derived distros like CentOS.

I'd do a PR but gist doesn't support them. :)


Copy link

Thanx for sharing!

Copy link

Hi everybody, I am trying to configure a bridge between: CLOUD SERVER: mosquitto broker installed in a virtual machine (google cloud) and LOCAL SERVER: openwrt router with mosquitto broker installed.
Cloud server has been configured with let's encrypt certbot. Everything works well: nodered webpage, mqtt broker with 8883 port, ....
Local server has nothing conifgured with let's encrypt, as I dont need to serve any web page on it.

Local server with "bridges" to cloud server.
My questions are:

  1. where I can get the files that I have to put in /etc/ssl/certs/ ? I have copy all files from cloud server to local server but it doesn't work. (I have several as certbot renews them every 90 days).
  2. Does Lets encrypt CA file to be renewed every 90 days? in that case, how could i do it in my openwrt local server?

Sorry but my knoweldge about certs is poor,

Thanks a lot for your help.

Copy link

Here is what worked for me. Adafruit needs username/feeds/yourstuff format. I couldn't figure it out, but I fixed it by setting the bridging back to my mqtt broker and viewing the output with this command mosquitto_sub -v -t '#' -u mqtt_username -P password

My feeds are coming in as /southpark/temperature , etc. and going out as /stanrock/feeds/temperature ..etc. This works with Adafruit io.

connection adafruit
bridge_attempt_unsubscribe false
cleansession false
notifications false
try_private false
remote_username stanrock
remote_password password
start_type automatic
bridge_protocol_version mqttv311

topic temperature out 0 /southpark/ stanrock/feeds/
topic pressure out 0 /southpark/ stanrock/feeds/
topic rssi out 0 /southpark/ stanrock/feeds/
topic waterlevel out 0 /southpark/ stanrock/feeds/
topic watertemp out 0 /southpark/ stanrock/feeds/
topic charger out 0 /southpark/ stanrock/feeds/
topic battemp out 0 /southpark/ stanrock/feeds/
topic uvindex out 0 /southpark/ stanrock/feeds/
topic uvvisible out 0 /southpark/ stanrock/feeds/
topic measuredvbat out 0 /southpark/ stanrock/feeds/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment