# Subscribing to MQTT Transmission Tags with paho.mqtt.client

**URL:** <https://forum.inductiveautomation.com/t/subscribing-to-mqtt-transmission-tags-with-paho-mqtt-client/59355>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [May 9, 2022, 12:48pm UTC](https://forum.inductiveautomation.com/t/subscribing-to-mqtt-transmission-tags-with-paho-mqtt-client/59355 "2022-05-09T12:48:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmahaf](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tmahaf/32/23492_2.png) [@tmahaf](https://forum.inductiveautomation.com/u/tmahaf)\
**Post date:** [May 9, 2022, 12:48pm UTC](https://forum.inductiveautomation.com/t/subscribing-to-mqtt-transmission-tags-with-paho-mqtt-client/59355/1 "2022-05-09T12:48:26Z")

</div>

I have a Ignition Maker license running an MQTT Engine and MQTT Transmission Module.

I am using the Transmission Module to subscribe to the tags in this folder (topic):

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

I’m able to subscribe to messages that the transmission module is publishing, I’m not having much luck decoding the message in a meaningful way.

Here is my function which decodes the message

```auto
def on_message(client,userdata, msg):

    topic=msg.topic
    m_decode=str(msg.payload.decode("utf-8","ignore"))

    print ('message received')
    print ('topic for this message: ', msg.topic)
    print ('raw payload: ',msg.payload)
    print ('payload with utf8 decoding:', m_decode, '\n')

```

Here is what the payload looks like, raw and decoded:

```auto
message received
topic for this message: spBv1.0/default/DDATA/SWD/CATTLE CREEK INJECTION PAD 1
raw payload: b'\x08\xb0\xc8\xe8\xc6\x8a0\x12E\n1SWD/CATTLE CREEK INJECTION PAD 1/ANNULUS PRESSURE\x18\xc7\xc0\xe8\xc6\x8a0 \t8\x00J\x00e\xf8u$C\x12D\n0SWD/CATTLE CREEK INJECTION PAD 1/TUBING PRESSURE\x18\xc7\xc0\xe8\xc6\x8a0 \t8\x00J\x00ezXsD\x12D\n0SWD/CATTLE CREEK INJECTION PAD 1/CASING PRESSURE\x18\xc9\xc0\xe8\xc6\x8a0 \t8\x00J\x00e\x13S\x1eE\x18o'
payload with utf8 decoding:Ɗ0E
1SWD/CATTLE CREEK INJECTION PAD 1/ANNULUS PRESSUREƊ0 8 J eu$CD
0SWD/CATTLE CREEK INJECTION PAD 1/TUBING PRESSUREƊ0 8 J ezXsDD
0SWD/CATTLE CREEK INJECTION PAD 1/CASING PRESSUREƊ0 8 J eSEo 

```

---

<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:** [May 9, 2022, 12:51pm UTC](https://forum.inductiveautomation.com/t/subscribing-to-mqtt-transmission-tags-with-paho-mqtt-client/59355/2 "2022-05-09T12:51:16Z")

</div>

The messages are encoded in the format defined by [Sparkplug](https://www.eclipse.org/tahu/spec/Sparkplug%20Topic%20Namespace%20and%20State%20ManagementV2.2-with%20appendix%20B%20format%20-%20Eclipse.pdf).

It might be easier to consume them if you use one of the available [Sparkplug client libraries](https://github.com/eclipse/tahu).
