如何启用和设置边缘设备 MQTT 代理
  • 31 Oct 2023
  • 1 分钟阅读
  • 贡献者

如何启用和设置边缘设备 MQTT 代理


Article Summary

目的

了解如何在 Tulip Edge 设备上设置外部 MQTT 代理

从操作系统 50.1 开始,Tulip Edge 设备有一个外部 MQTT 代理,客户端设备可以连接到该代理。

操作说明

  1. 登录边缘设备门户。
  2. 在 "网络配置 "部分底部,选择 "MQTT 代理 "选项。

  1. 单击 "启用",输入所需的用户名和密码,然后点击 "保存"。

使用 Node-RED 的 MQTT 代理

要确认代理是否可用,我们可以使用 Node-RED MQTT IN 节点。

  1. 如果 Node-RED 处于关闭状态,请将其打开并登录 Node-RED 编辑器。
  2. 在流程中添加一个 MQTT 节点并编辑该节点。

  1. 单击 "铅笔 "按钮打开代理配置,并将 "服务器 "设置为localhost

  1. 点击 "安全 "选项卡,输入为代理配置的用户名和密码。

  1. 单击 "Update(更新)"保存设置。
  2. 单击 "Deploy(部署)"检查节点是否能连接到代理。

Node-RED 流程示例

可以将下面的示例保存为 JSON 文件并导入 Node-RED,向 "hello "主题发送 "world "消息。


 {  

 "id":"c8829f45.d66fd",  

 "type": "tab"、  

 "label": "Flow 1"、  

 "disabled":false、  

 "信息":"  

 },  

 {  

 "id":"983032d6.f2f378",  

 "类型": "调试"、  

 "z":"c8829f45.d66fd",  

 "名称":""、  

 "active":true、  

 "tosidebar":true、  

 "console":false、  

 "tostatus":false、  

 "complete": "topic"、  

 "targetType": "msg"、  

 "statusVal":""、  

 "statusType": "auto"、  

 "x":800,  

 "y":180,  

 "电线":[ 



]


},  

 {  

 "id":"39d4c518.6948ba",  

 "类型": "注入"、  

 "z":"c8829f45.d66fd",  

 "名称":""、  

 "道具": [  

 {  

 "p": "payload  

 },  

 {  

 "p": "topic"、  

 "vt": "str"  

 }  

 ],  

 "重复":""、  

 "crontab":""、  

 "once":false、  

 "onceDelay":0.1、  

 "topic": "hello"、  

 "payload": "world"、  

 "payloadType": "str"、  

 "x":480,  

 "y":120,  

 "电线":[  

 [  

 "33035adc.d4eae6" [  

 ]  

 ]  

 },  

 {  

 "id":"f7839332.ea3a98",  

 "type": "mqtt in"、  

 "z":"c8829f45.d66fd",  

 "name": "MQTT Receive All"、  

 "主题":"


## ",



"qos": "2", "datatype": "auto", "broker": "6f327e4f.0a172", "nl":false, "rap":true, "rh":0, "x":450, "y":200, "wires":[ "983032d6.f2f378", "97df7c35.a8d228" ]] ]</p


},  

 {  

 "id":"33035adc.d4eae6",  

 "type": "mqtt out"、  

 "z":"c8829f45.d66fd",  

 "name": "MQTT Send Hello"、  

 "主题":""、  

 "qos":""、  

 "保留":""、  

 "respTopic":""、  

 "contentType":""、  

 "用户道具":""、  

 "correl":""、  

 "到期":""、  

 "broker":"6f327e4f.0a172",  

 "x":830,  

 "y":120,  

 "wires":[ 



]


},  

 {  

 "id":"97df7c35.a8d228",  

 "类型": "调试"、  

 "z":"c8829f45.d66fd",  

 "名称":""、  

 "active":true、  

 "tosidebar":true、  

 "console":false、  

 "tostatus":false、  

 "complete": "payload"、  

 "targetType": "msg"、  

 "statusVal":""、  

 "statusType": "auto"、  

 "x":810,  

 "y":240,  

 "电线":[ 



]


},  

 {  

 "id":"6f327e4f.0a172",  

 "type": "mqtt-broker"、  

 "名称":""、  

 "broker": "localhost"、  

 "端口": "1883  

 "clientid":""、  

 "usetls":false、  

 "协议版本": "5"、  

 "keepalive": "60"、  

 "cleansession":true、  

 "出生主题":""、  

 "birthQos": "0"、  

 "birthPayload":""、  

 "出生信息":{ 



}, "closeTopic":"", "closeQos": "0", "closePayload":"", "closeMsg":{ }, "willTopic":"", "willQos": "0", "willPayload":"", "willMsg":{ }, "sessionExpiry":""


}  

] ```




---


找到您要找的东西了吗?


您还可以前往[community.tulip.co](https://community.tulip.co/?utm_source=intercom&utm_medium=article-link&utm_campaign=all)发布您的问题,或查看其他人是否遇到过类似问题!


本文对您有帮助吗?