本文实现了NodeRed Mqtt in节点接收订阅消息的功能.可接收局域网或远程发布的消息.接收远程消息需要使用花生棒实现内网映射,内网映射请参见我的博客,链接如下:
https://blog.youkuaiyun.com/armcsdn/article/details/103131048
流程图如下:

流程代码:
[{
"id": "798c173.51be2e8",
"type": "tab",
"label": "流程4",
"disabled": false,
"info": ""
}, {
"id": "60445af9.e992e4",
"type": "mqtt in",
"z": "798c173.51be2e8",
"name": "",
"topic": "Sensor/Temperature/Room1",
"qos": "2",
"datatype": "auto",
"broker": "42208823.88ab68",
"x": 260,
"y": 200,
"wires": [
["ff327446.361ce8"]
]
}, {
"id": "ff327446.361ce8",
"type": "debug",
"z": "798c173.51be2e8",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 290,
"y": 300,
"wires":

本文详细介绍了如何使用Node-RED的MQTT in节点来接收订阅的消息,包括局域网和远程消息的接收方法。通过配置MQTT broker,设置订阅主题和质量等级,演示了如何利用Node-RED进行消息监听,并提供了两种发布者实现方式:一是通过命令行使用mosquitto_pub,二是使用Python结合paho-mqtt库实现消息发布。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



