一、概述
1.EMQX
1
2
3
4
# 4.4
docker pull emqx/emqx:4.4.17
docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 emqx/emqx:4.4.17
1
2
3
4
5
6
7
账号:admin
初始密码:public
修改密码:1qaz2wsx
http://192.168.202.168:18083
账号:admin
修改密码:1qaz2wsx
2.MQTTX
二、发布数据到MQTT
1.Node-RED配置
1.1.配置 mqtt out
1.2.配置流程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
v1/devices/me/telemetry
{
"stringKey": "value1",
"booleanKey": true,
"doubleKey": 42.0,
"longKey": 73,
"jsonKey": {
"someNumber": 42,
"someArray": [1, 2, 3],
"someNestedObject": {
"key": "value"
}
}
}
2.MQTTX订阅数据
3.测试
三、从MQTT订阅数据
1.Node-RED配置
1.1.配置 mqtt in
1.2.配置流程
2.MQTT发布数据
1
2
3
4
5
6
v1/devices/me/attribute
{
"temperature": 62.2,
"humidity": 79
}
3.测试
四、MQTT-Broker
1.node-red-contrib-aedes
1
2
3
node-red-contrib-aedes
https://flows.nodered.org/node/node-red-contrib-aedes
2.安装节点
3.配置 MQTT Broker
1
MQTT version: 3.1.1