# MQTT topic name

**URL:** <https://forum.inductiveautomation.com/t/mqtt-topic-name/67304>\
**Category:** Maker\
**Created:** [December 6, 2022, 7:24pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304 "2022-12-06T19:24:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vidar\_Hetlelid1](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@Vidar\_Hetlelid1](https://forum.inductiveautomation.com/u/Vidar_Hetlelid1)\
**Post date:** [December 6, 2022, 7:24pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/1 "2022-12-06T19:24:47Z")

</div>

Hello,

I am testing out MQTT transmission, but im not getting quite the results that i want..

I am connected to my HiveMQ broker, and I want to publish to

/wago/test

with payload "456".

When i change the value of "New Tag" to 567 like this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/3/436e370be41455a9e71a474159ce052a97b48045.png)

I get this message in my PLC:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/d/ed1853ffa572394cdf09eda26100fb0b36e1c6fb.png)

Any idea what is wrong here?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 6, 2022, 7:27pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/2 "2022-12-06T19:27:52Z")

</div>

Is one side talking Sparkplug and the other side not?

---

<div class="post-metadata">

**Author:** ![Vidar\_Hetlelid1](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@Vidar\_Hetlelid1](https://forum.inductiveautomation.com/u/Vidar_Hetlelid1)\
**Post date:** [December 6, 2022, 7:33pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/3 "2022-12-06T19:33:03Z")

</div>

Thanks for fast reply!

I dont know what sparkplug is... but will look into it. But i checked my PLC, and its set to Native MQTT:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/42d2ede8acc793c68f2808c5227874a969272951.png)

How do I know if Ignition maker is sparkplug or not? Ive just installed it, so its whatever the default is 🙂

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 6, 2022, 7:34pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/4 "2022-12-06T19:34:30Z")

</div>

It's probably Sparkplug. Change that setting to "Sparkplug payload B" and see if things work.

---

<div class="post-metadata">

**Author:** ![Vidar\_Hetlelid1](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@Vidar\_Hetlelid1](https://forum.inductiveautomation.com/u/Vidar_Hetlelid1)\
**Post date:** [December 6, 2022, 7:37pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/5 "2022-12-06T19:37:57Z")

</div>

I tried to that but no difference...

Also hive MQ has a online MQTT subscribe tool, and the result is just as cryptical:

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [December 6, 2022, 7:39pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/6 "2022-12-06T19:39:19Z")

</div>

You're looking at Sparkplug-encoded data, which it may not understand.

If you want to use "vanilla" MQTT then on the Ignition side you need to use a custom namespace instead, and on the PLC side you would presumably use "Native MQTT". You should probably spend some time reading these docs: [MQTT Engine Custom Namespace - MQTT Modules for Ignition 8.x - Confluence](https://docs.chariot.io/display/CLD80/MQTT+Engine+Custom+Namespace)

---

<div class="post-metadata">

**Author:** ![Vidar\_Hetlelid1](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@Vidar\_Hetlelid1](https://forum.inductiveautomation.com/u/Vidar_Hetlelid1)\
**Post date:** [December 6, 2022, 7:44pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/7 "2022-12-06T19:44:10Z")

</div>

Ah okay thanks!

I'll read the article, but MQTT Engine is only for reading recieved data, right? Because im publishing data from Ignition to my HiveMQ broker, which my PLC is subscribing from.

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [December 6, 2022, 7:50pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/8 "2022-12-06T19:50:00Z")

</div>

> [@Vidar\_Hetlelid1](#):
>
> ... but MQTT Engine is only for reading recieved data, right?

This is mostly true for Custom Namespaces in MQTT Engine. You'll probably need to utilize the Python scripting functions in that module, such as [system.cirruslink.engine.publish](https://docs.chariot.io/display/CLD80/ME%3A+Python+Scripting#ME:PythonScripting-publish) to publish messages back to the broker.

That said, if your PLC supports Sparkplug B natively, that's [probably] the best way to go.

---

<div class="post-metadata">

**Author:** ![Vidar\_Hetlelid1](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@Vidar\_Hetlelid1](https://forum.inductiveautomation.com/u/Vidar_Hetlelid1)\
**Post date:** [December 6, 2022, 8:05pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/9 "2022-12-06T20:05:00Z")

</div>

Uhm... i think this scripting thing is over my head..

Also, i think i should go with native MQTT since my ESP32's around the house will be connected that way. So, if I can collect all the data in Ignition with MQTT engine with cusom namespace, and write from ignition to Hive MQ Broker im happy. I just need to get the message sent correctly 🙂

---

<div class="post-metadata">

**Author:** ![Vidar\_Hetlelid1](https://avatars.discourse-cdn.com/v4/letter/v/53a042/32.png) [@Vidar\_Hetlelid1](https://forum.inductiveautomation.com/u/Vidar_Hetlelid1)\
**Post date:** [December 6, 2022, 9:09pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/10 "2022-12-06T21:09:59Z")

</div>

So... I feel like im onto something. I have created a namespace for all recieved messages (#).

Those are the messages i am publishing:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/dac26a9e51406ce675571b4bdbe7c09da946f58b.png)

And in ignition it looks like this. Is says value is 2501/gging, when it should be 250. When using the tag in a gauge, it shows up correctly.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/2/021aa449900e8f9cddf40bc113b5e2e820418460.png)

I tried to change the encoding charset to all available options, but UTF\_8 seems most correctly, even if it isnt.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f631cffc35ad517676bbc4555b431e48db949942.png)

Any ideas?

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [December 6, 2022, 11:22pm UTC](https://forum.inductiveautomation.com/t/mqtt-topic-name/67304/11 "2022-12-06T23:22:50Z")

</div>

Can you open the _Script Console_ (via _Tools_ menu) in the Designer and show the output from the following?

```python
read_result = system.tag.readBlocking(["[MQTT Engine]test/sensor2"])[0].value
print("Result is: %s" % read_result)

```
