# Configure mqtt-broker node from Dashboard

**URL:** <https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645>\
**Category:** General\
**Tags:** node-red-dashboard, mqtt\
**Created:** [15 November 2022 12:33 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645 "2022-11-15T12:33:35Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adri\_gl](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Adri\_gl](https://discourse.nodered.org/u/Adri_gl)\
**Post date:** [15 November 2022 12:33 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/1 "2022-11-15T12:33:35Z")

</div>

Hello everyone,

I am trying to configure the mqtt-broker node from the dashboard.  
I've been searching the forum for a while to see if anyone has tried it, but i haven´t found it.

My intention is with a form node to fill all these fields, instead of filling them from the mqtt-in/mqtt-out node.

Can someone tell me how i can do it?

Thanks.

---

<div class="post-metadata">

**Author:** ![Adri\_gl](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Adri\_gl](https://discourse.nodered.org/u/Adri_gl)\
**Post date:** [17 November 2022 11:20 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/2 "2022-11-17T11:20:29Z")

</div>

What i´ve thinked is something like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/5445d65e8d157885b7b19d27b7007780bf19c07b.png)

and save this information in a global context to use later and configure mqtt-broker node. But i don´t know how to do that

---

<div class="post-metadata">

**Author:** ![Josh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josh/32/62208_2.png) [@Josh](https://discourse.nodered.org/u/Josh)\
**Post date:** [17 November 2022 11:43 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/3 "2022-11-17T11:43:11Z")

</div>

This link might be useful. Click [here](https://nodered.org/docs/user-guide/context)

---

<div class="post-metadata">

**Author:** ![Adri\_gl](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Adri\_gl](https://discourse.nodered.org/u/Adri_gl)\
**Post date:** [17 November 2022 13:29 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/4 "2022-11-17T13:29:45Z")

</div>

Thanks, but my problem is that i want to set server properties via msg properties as i can do it with the topic, qos or retain properties.  
Something like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e8e607d2bdbcf13e617515c12e3642bd8e7b78f8.png)  
[flows (3).json](https://discourse.nodered.org/uploads/short-url/2BPjtmfUIuMepAXtAosHwWH8Weo.json) (5.5 KB)  
To fill broker object.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/12b6b2798340c75138a16fae987360136affe4fe.png)

---

<div class="post-metadata">

**Author:** ![Josh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josh/32/62208_2.png) [@Josh](https://discourse.nodered.org/u/Josh)\
**Post date:** [17 November 2022 14:19 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/5 "2022-11-17T14:19:30Z")

</div>

Hi Since you are new to the forum, Please have a look at [this](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506) to attach your flows.  
To answer your question:  
The mqtt-in node doesnt support setting the server details dynamically for various reasons. But, you could do it via environment variables.

Here are the steps:

- Use a change node and set msg.properties(Obtained from UI) to an environmental variable say MY\_ENV\_VAR.
- Open the server details inside your node and enter ${MY\_ENV\_VAR} in the text box. This should allow you to dynamically set the server configs from your UI.

---

<div class="post-metadata">

**Author:** ![Adri\_gl](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Adri\_gl](https://discourse.nodered.org/u/Adri_gl)\
**Post date:** [18 November 2022 10:32 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/6 "2022-11-18T10:32:05Z")

</div>

Hi, should I make an environmental variable for each properties? or Can I make an object with the properties? I am currently testing this second option, but when I go to search for the property MY\_ENV\_VAR.name does not return the value.

Thanks

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 November 2022 15:26 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/7 "2022-11-18T15:26:43Z")

</div>

I believe node red need to be restarted to see a change in an environment variable.

---

<div class="post-metadata">

**Author:** ![Josh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josh/32/62208_2.png) [@Josh](https://discourse.nodered.org/u/Josh)\
**Post date:** [21 November 2022 06:45 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/8 "2022-11-21T06:45:30Z")

</div>

True that..

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 November 2022 07:24 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/9 "2022-11-21T07:24:19Z")

</div>

> [@Josh](#):
>
> The mqtt-in node doesnt support setting the server details dynamically for various reasons

That is no longer true. Have a look at the help text for the MQTT In node for the section on dynamic control.

---

<div class="post-metadata">

**Author:** ![Josh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josh/32/62208_2.png) [@Josh](https://discourse.nodered.org/u/Josh)\
**Post date:** [21 November 2022 07:42 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/10 "2022-11-21T07:42:43Z")

</div>

Thanks for this. Ill check that out.

---

<div class="post-metadata">

**Author:** ![Adri\_gl](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Adri\_gl](https://discourse.nodered.org/u/Adri_gl)\
**Post date:** [21 November 2022 08:43 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/11 "2022-11-21T08:43:30Z")

</div>

> [@Colin](#):
>
> That is no longer true. Have a look at the help text for the MQTT In node for the section on dynamic control.

Configuring MQTT In node allows change MQTT out node server and port?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 November 2022 09:07 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/12 "2022-11-21T09:07:33Z")

</div>

> [@Adri\_gl](#):
>
> Configuring MQTT In node allows change MQTT out node server and port?

Did you check the help text for the Out node?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 November 2022 09:09 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/13 "2022-11-21T09:09:29Z")

</div>

See this post for examples of how to configure dynamic MQTT [Dynamic MQTT node's "actions-\>connect" guidance needed](https://discourse.nodered.org/t/dynamic-mqtt-nodes-actions-connect-guidance-needed/58878)

---

<div class="post-metadata">

**Author:** ![Adri\_gl](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@Adri\_gl](https://discourse.nodered.org/u/Adri_gl)\
**Post date:** [24 November 2022 09:04 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/14 "2022-11-24T09:04:54Z")

</div>

thanks for your help.

It works!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 December 2022 09:05 UTC](https://discourse.nodered.org/t/configure-mqtt-broker-node-from-dashboard/70645/15 "2022-12-08T09:05:48Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
