I created the above example when i was in need to just receive information from clients connected to the mqttcloud.
topic # in enables all published topics from every client to cross the bridge to your mqtt broker but only in that direction
Later when i connected new sonoff devices on the cloud that i needed to control i needed to let the bridge know to let some messages cross the bridge in the oposite direction
broker -> bridge -> remote client
If you want all your topics to be published both to the local broker and the cloud mqtt you should change that line to
topic # both meaning that it enables all messages (# wildcard) on both directions.
In my case, i didnt want all my home topics and devices to be published online. So i formated the selected topics in this way
cmnd/remote_location_name/device_name/rest_of_command (where cmnd is the syntax that tasmota sonoffs use) and i wanted all the topics that contain
***/remote_location_name/*** to be published to the cloudmqtt server.
*The mqtt topics on the remote devices were changed too to reflect this syntax
So i added a new filter to the end of the file and my new
mosquitto.conf file is something like this:
address cloudmqttIPaddress:PORT #you get these from the details page on cloudMQTT
remote_password HA-PASS #whatever un/pass you set up for HA above on the cloudmqtt users
topic # in
topic +/remote_location_name/# out
+ symbol is a wild card for only one part of the topic (that would be cmnd usually) and the
# symbol is a wildcard for multiple topic parts so, a topic
cmnd/remote_location_name/device_name/power/on would fit the profile, pass through the filter and get published to the cloudmqtt server for the remote devices to read.
More documentation about configuring your
mosquitto.conf file here
Hope this helps.
edit: At some point i had the need to connect more than 5 remote devices which is the maximum allowed per mqtt instance. In that case i just created a second instance and i split my devices between the two:
Had to change my
mosquitto.conf to connect to two bridges:
topic # in 0
topic +/topic_of_instance_1/# out 0
topic # in 0
topic +/topic_of_instance_2/# out 0
I found that i need to use different topics between the two bridges, or else it gets messy