4

I am trying to setup MQTT bridge, where I want to publish all local topic to remote, but subscribe only certain remote topic which matches wild card and remap to local broker

Here is the config

 topic # out 2 "" UP/site1/
 topic DOWN/site1/# in 2 DOWN/ DOWN/site1/

local to remote publishing works perfectly, but remote to local mapping doesn't works.

I just want to pull topics with prefix DOWN/site1/# from remote to local broker and remove the prefix DOWN/site1/.

I am using cloudmqtt.com as remote and local MQTT (bridge) running on Raspberry Pi Zero.

Any help here ?

3

You want something like this for the last line:

topic # in 2 "" Down/site1/

This is because the first topic is relative to the last remote topic prefix.

The following example from the mosquitto docs will hopefully make it clearer:

The configuration below connects a bridge to the broker at test.mosquitto.org. It subscribes to the remote topic $SYS/broker/clients/total and republishes the messages received to the local topic test/mosquitto/org/clients/total

connection test-mosquitto-org
address test.mosquitto.org
cleansession true
topic clients/total in 0 test/mosquitto/org $SYS/broker/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.