用于OUT / IN主题过滤器的mqtt网桥配置

时间:2018-12-23 23:10:00

标签: mqtt iot raspbian

我正在尝试将MQTT桥设置为cloudmqtt.com。在raspbian上运行的本地网桥。

我想按原样将本地主题(UP/site1/#)推送到cloudmqtt代理,并将远程主题('Down / site1 /#')拉到本地网桥。 尝试了以下配置,但没有用

  1. topic UP/site1/# out 2

    topic Down/site1/# in 2

  2. topic UP/site1/# out 2 UP/site1/ UP/site1/

    topic Down/site1/# in 2 Down/site1/ Down/site1/

  3. topic UP/site1/# out 2 "" ""

    topic Down/site1/# in 2 "" ""

这是完整的配置

connection cloudmqtt
address *****.cloudmqtt.com:1883
bridge_protocol_version mqttv311
remote_username ****
remote_password ****
try_private false
start_type automatic
notifications false
cleansession false
topic UP/site1/# out 2
topic Down/site1/# in 2

桥日志消息:

1545695073: Received PINGREQ from 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695073: Sending PINGRESP to 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695073: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (191 bytes))
1545695076: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (190 bytes))
1545695079: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (190 bytes))
1545695082: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (191 bytes))
1545695083: Received PINGREQ from 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695083: Sending PINGRESP to 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695085: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (189 bytes))
1545695089: Bridge ff001.cloudmqtt sending CONNECT
1545695089: Received CONNACK on connection local.ff001.cloudmqtt.
1545695089: Bridge local.ff001.cloudmqtt sending UNSUBSCRIBE (Mid: 12, Topic: UP/site1/#)
1545695089: Bridge local.ff001.cloudmqtt sending SUBSCRIBE (Mid: 13, Topic: Down/site1/#, QoS: 2)
1545695089: Bridge local.ff001.cloudmqtt doing local SUBSCRIBE on topic UP/site1/#
1545695089: Received UNSUBACK from local.ff001.cloudmqtt
1545695089: Received SUBACK from local.ff001.cloudmqtt
1545695090: No will message specified.
1545695090: Sending CONNACK to pod01 (0, 0)
1545695090: No will message specified.
1545695090: Sending CONNACK to 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782 (0, 0)
1545695092: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (190 bytes))
1545695095: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (190 bytes))
1545695098: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (191 bytes))
1545695100: Received PINGREQ from 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695100: Sending PINGRESP to 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695101: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (191 bytes))
1545695104: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (192 bytes))
1545695107: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (191 bytes))
1545695110: Received PINGREQ from 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695110: Sending PINGRESP to 8de7c6e8-4c6a-49b0-9aaa-5816aa9504901545604132782
1545695110: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (191 bytes))
1545695113: Received PUBLISH from pod01 (d0, q0, r0, m0, 'UP/site01/pod01', ... (192 bytes))

我有mosquitto_1.5.5

如果我删除/输入通配符并将其替换为topic # both 2,它将起作用。但是我不想拉所有仅针对站点(Down/site1/#)的远程主题,而将所有本地主题推到远程。在以上来自网桥的日志中,它似乎没有将本地主题发布到远程cloudMQTT。

任何人都知道我在这里缺少什么,我需要更改远程MQTT(cloudmqtt实例)上的任何内容吗?

1 个答案:

答案 0 :(得分:2)

您正在与UP/site1/#建立桥梁,并发布到UP/site01/...

问题是site1!= site01