- Print
How to Enable and Set Up the Edge Device MQTT Broker
Article summary
Did you find this summary helpful?
Thank you for your feedback
Purpose
Learn how to set up an external MQTT broker on Tulip Edge Devices
Beginning with OS 50.1, Tulip Edge Devices have an external MQTT broker to which client devices can connect.
Instructions
- Log into the Edge Device Portal.
- At the bottom of the "Network configuration" section, select the "MQTT Broker" option.
- Click "Enable", enter in a desired username and password, and hit "Save".
Using the MQTT Broker with Node-RED
To confirm the broker is available, we can use a Node-RED MQTT IN node.
- If Node-RED is off, turn it on and log in to the Node-RED editor.
- Add an MQTT node to your flow and edit the node.
- Click the pencil button to open the broker configuration and set "Server" to
localhost
.
- Click on the "Security" tab and enter the username and password configured for the broker.
- Click "Update" to save the settings.
- Click "Deploy" to check if the node can connect to the broker.
Example Node-RED Flow
The example below can be saved as a JSON file and imported to Node-RED to send a "world" message to the "hello" topic.
[
{
"id":"c8829f45.d66fd",
"type":"tab",
"label":"Flow 1",
"disabled":false,
"info":""
},
{
"id":"983032d6.f2f378",
"type":"debug",
"z":"c8829f45.d66fd",
"name":"",
"active":true,
"tosidebar":true,
"console":false,
"tostatus":false,
"complete":"topic",
"targetType":"msg",
"statusVal":"",
"statusType":"auto",
"x":800,
"y":180,
"wires":[
]
},
{
"id":"39d4c518.6948ba",
"type":"inject",
"z":"c8829f45.d66fd",
"name":"",
"props":[
{
"p":"payload"
},
{
"p":"topic",
"vt":"str"
}
],
"repeat":"",
"crontab":"",
"once":false,
"onceDelay":0.1,
"topic":"hello",
"payload":"world",
"payloadType":"str",
"x":480,
"y":120,
"wires":[
[
"33035adc.d4eae6"
]
]
},
{
"id":"f7839332.ea3a98",
"type":"mqtt in",
"z":"c8829f45.d66fd",
"name":"MQTT Receive All",
"topic":"
##",
"qos":"2",
"datatype":"auto",
"broker":"6f327e4f.0a172",
"nl":false,
"rap":true,
"rh":0,
"x":450,
"y":200,
"wires":[
[
"983032d6.f2f378",
"97df7c35.a8d228"
]
]
},
{
"id":"33035adc.d4eae6",
"type":"mqtt out",
"z":"c8829f45.d66fd",
"name":"MQTT Send Hello",
"topic":"",
"qos":"",
"retain":"",
"respTopic":"",
"contentType":"",
"userProps":"",
"correl":"",
"expiry":"",
"broker":"6f327e4f.0a172",
"x":830,
"y":120,
"wires":[
]
},
{
"id":"97df7c35.a8d228",
"type":"debug",
"z":"c8829f45.d66fd",
"name":"",
"active":true,
"tosidebar":true,
"console":false,
"tostatus":false,
"complete":"payload",
"targetType":"msg",
"statusVal":"",
"statusType":"auto",
"x":810,
"y":240,
"wires":[
]
},
{
"id":"6f327e4f.0a172",
"type":"mqtt-broker",
"name":"",
"broker":"localhost",
"port":"1883",
"clientid":"",
"usetls":false,
"protocolVersion":"5",
"keepalive":"60",
"cleansession":true,
"birthTopic":"",
"birthQos":"0",
"birthPayload":"",
"birthMsg":{
},
"closeTopic":"",
"closeQos":"0",
"closePayload":"",
"closeMsg":{
},
"willTopic":"",
"willQos":"0",
"willPayload":"",
"willMsg":{
},
"sessionExpiry":""
}
]
Did you find what you were looking for?
You can also head to community.tulip.co to post your question or see if others have faced a similar question!
Was this article helpful?