# Mqtt Sparkplug B and custom namespace

**URL:** <https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815>\
**Category:** 3rd Party Modules\
**Created:** [October 27, 2024, 10:12pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815 "2024-10-27T22:12:15Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoones\_sanjabi1](https://avatars.discourse-cdn.com/v4/letter/y/e47c2d/32.png) [@yoones\_sanjabi1](https://forum.inductiveautomation.com/u/yoones_sanjabi1)\
**Post date:** [October 27, 2024, 10:12pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/1 "2024-10-27T22:12:15Z")

</div>

Hi,

I have a question regarding the mqtt module:

I have two connections to the EMQX broker: Test1 (SM/#) and Test3 (spBv1.0/#). I publish data from Ignition Transmission to Test3, while we use LoRa to publish data to Test1.

On the other ignition side, we have MQTT Engine set up to receive data from both Test1 and Test3. However, I’m having trouble getting both to work together.

If I enable Sparkplug B, I have to remove the custom namespace to receive data from Test3, but this causes an error with Test1. On the other hand, if I disable Sparkplug B and add the namespace (SM/#), I can receive data from Test1, but Test3 stops working.

Here are some screenshots of what I did:  
MQTT Engine:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/5/c557f59c63ba937f8db1e1d4267cd69fb5d097d6.png)

Ignition designer:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/82d2d94a98059c6c77870fecb6072b1b14823d9a.png)

MQTT Broker:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/9/c960bcb7811851313346e876b6c5c256cc896582.png)

Ignition Namespace:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/2/82110c3c3813149a53430f3ac37ddfb49cd6f405.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/9/b9d0572eb29706c5ff6000d5f8f814b0b12cc281.png)

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [October 28, 2024, 2:12am UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/2 "2024-10-28T02:12:29Z")

</div>

I'm not sure how to solve this problem, but Cirrus Link has their own forum. It's possible that you will be able to find a solution already posted there:

> **[Cirrus Link Forum](https://forum.cirrus-link.com/latest?ascending=true&order=views)**
>
> A place to discuss software from Cirrus Link Solutions

---

<div class="post-metadata">

**Author:** ![bill.liu](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bill.liu](https://forum.inductiveautomation.com/u/bill.liu)\
**Post date:** [October 28, 2024, 9:44am UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/3 "2024-10-28T09:44:00Z")

</div>

On your first screenshot, Test3 is showing as "Not Connected". Does it become connected if you just enable the Sparkplug B namespace?

Maintaining a connection to the MQTT broker is at a lower level to the Sparkplug B protocol. You should be able to connect to all your brokers regardless of which topics are subscribed to.

Check the gateway logs, it might give you more meaningful error messages.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [October 28, 2024, 10:15am UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/4 "2024-10-28T10:15:43Z")

</div>

Are you on the latest version of the module? They've recently been making some big changes/improvements that are only in the latest version, so wouldn't hurt to make sure you're on the latest just in case.

I don't have time right now, but this evening I'll play with it in a VM I have set up for testing MQTT. I was only testing sparkPlugB, but will test it with a custom namespace at the same time also.

---

<div class="post-metadata">

**Author:** ![yoones\_sanjabi1](https://avatars.discourse-cdn.com/v4/letter/y/e47c2d/32.png) [@yoones\_sanjabi1](https://forum.inductiveautomation.com/u/yoones_sanjabi1)\
**Post date:** [October 28, 2024, 10:45am UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/5 "2024-10-28T10:45:37Z")

</div>

Yes, it frequently switches between connecting and not connected states when I enable it.

ME-e67ecb13-ace4-4e69: server Test3 - Failed subscribe on [SM/test, spBv1.0/#] granted QoS [0, 0] != [128, 0]

ME-ab6f5668-904e-4d16: server Test1 - Failed subscribe on [SM/test, spBv1.0/#] granted QoS [0, 0] != [0, 128]

---

<div class="post-metadata">

**Author:** ![yoones\_sanjabi1](https://avatars.discourse-cdn.com/v4/letter/y/e47c2d/32.png) [@yoones\_sanjabi1](https://forum.inductiveautomation.com/u/yoones_sanjabi1)\
**Post date:** [October 28, 2024, 10:47am UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/6 "2024-10-28T10:47:01Z")

</div>

I have 4.0.24 for MQTT Engine and 8.1.43 for ignition

thank you

---

<div class="post-metadata">

**Author:** ![bill.liu](https://avatars.discourse-cdn.com/v4/letter/b/9fc348/32.png) [@bill.liu](https://forum.inductiveautomation.com/u/bill.liu)\
**Post date:** [October 28, 2024, 11:51am UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/7 "2024-10-28T11:51:19Z")

</div>

I suspect the Lora client and the Ignition client have the same client ID (client name) which caused emqx to disconnect the existing client when a new connection is made. Make sure clients have unique names.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [October 28, 2024, 12:18pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/8 "2024-10-28T12:18:39Z")

</div>

That should be a rare conflict if defaults are used because Transmission uses random client IDs (unless they're manually configured to use a static client ID).

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 28, 2024, 1:42pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/9 "2024-10-28T13:42:00Z")

</div>

You need to adjust the "Filtered Namespaces" option in the advanced settings of each server connection:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/4/94c5fc5bda28e8b53abc9337f31fffd8aef0c356.png)

Or, that should do the trick at least. I haven't tried it with sparkplug on one and a custom namespace on the other.

But, I think you would need to put "Sparkplug B" on one server and "New Custom Namespace" on the other.

The hint is the "Failed to subscribe" messages you showed above. It's trying to subscribe to both topics on both servers, and I'm assuming your MQTT ACLs are rejecting that. If MQTT Engine gets a subscription failure, the default behavior is to drop the whole connection and retry.

---

<div class="post-metadata">

**Author:** ![yoones\_sanjabi1](https://avatars.discourse-cdn.com/v4/letter/y/e47c2d/32.png) [@yoones\_sanjabi1](https://forum.inductiveautomation.com/u/yoones_sanjabi1)\
**Post date:** [October 28, 2024, 7:40pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/10 "2024-10-28T19:40:53Z")

</div>

They aren't same and have unique name as well

---

<div class="post-metadata">

**Author:** ![yoones\_sanjabi1](https://avatars.discourse-cdn.com/v4/letter/y/e47c2d/32.png) [@yoones\_sanjabi1](https://forum.inductiveautomation.com/u/yoones_sanjabi1)\
**Post date:** [October 28, 2024, 7:44pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/11 "2024-10-28T19:44:50Z")

</div>

I also tried using QoS1 for custom name space and QoS0 for sparkplug, but the connection is still erratic.

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [October 28, 2024, 7:49pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/12 "2024-10-28T19:49:10Z")

</div>

Did you note that the "Filtered Namespaces" is supposed to be the list of namespaces to _disable_ for that server? So, on the "Test1" connection that is supposed to be receiving LoRa you would put "Sparkplug B" in that box, and on the "Test2" connection that is supposed to be receiving SpB you would put "New Custom Namespace" in that box?

EDIT: Are you still seeing the "Failed subscribe on" errors in the log after changing the namespace? That was definitely previously the cause of your intermittent connections. If you're still getting that and they haven't changed, then you didn't setup the namespace filtering properly.

PS: I drove Saabs for many, many years and liked them a lot. No idea if you have any particular attachment to them, but it made me happy to see Scania in your profile.

---

<div class="post-metadata">

**Author:** ![yoones\_sanjabi1](https://avatars.discourse-cdn.com/v4/letter/y/e47c2d/32.png) [@yoones\_sanjabi1](https://forum.inductiveautomation.com/u/yoones_sanjabi1)\
**Post date:** [October 28, 2024, 8:56pm UTC](https://forum.inductiveautomation.com/t/mqtt-sparkplug-b-and-custom-namespace/97815/13 "2024-10-28T20:56:59Z")

</div>

Thank you so much for your help, Justin Brzozoski. We were finally able to connect both successfully!

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f45bf7660fc4ea48140aeb5e92bdc42542eae7f1.png)

P.S. I'm glad to hear that! Scania and Saab work closely together and, in many ways, operate as if they were the same company.
