# How to connect a UNS to the MQTT Engine and or MQTT Transmisson

**URL:** <https://forum.inductiveautomation.com/t/how-to-connect-a-uns-to-the-mqtt-engine-and-or-mqtt-transmisson/95261>\
**Category:** Ignition\
**Created:** [August 28, 2024, 1:41pm UTC](https://forum.inductiveautomation.com/t/how-to-connect-a-uns-to-the-mqtt-engine-and-or-mqtt-transmisson/95261 "2024-08-28T13:41:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_Hoekstra](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@Joshua\_Hoekstra](https://forum.inductiveautomation.com/u/Joshua_Hoekstra)\
**Post date:** [August 28, 2024, 1:41pm UTC](https://forum.inductiveautomation.com/t/how-to-connect-a-uns-to-the-mqtt-engine-and-or-mqtt-transmisson/95261/1 "2024-08-28T13:41:52Z")

</div>

Need some advice to see if this is possible with ignition. I have a UNS that i have to send tag data to that will be sent to a MQTT server with mosquito as its broker. I made a few clients on the UNS platform that was built but I am having issues trying to connect Ignition to UNS to write to. Any advice would be much appreciated

---

<div class="post-metadata">

**Author:** ![cos](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cos/32/66963_2.png) [@cos](https://forum.inductiveautomation.com/u/cos)\
**Post date:** [August 31, 2024, 9:58pm UTC](https://forum.inductiveautomation.com/t/how-to-connect-a-uns-to-the-mqtt-engine-and-or-mqtt-transmisson/95261/2 "2024-08-31T21:58:07Z")

</div>

Can you tell some more about your application setup?

One way is to use MQTT Engine to subscribe to the MQTT broker.  
It will automatically create ignition tags for all mqtt topics.

You can use the publish function of MQTT engine (or transmission) to publish mqtt topics.

```python
system.cirruslink.engine.publish('MQTT_SERVER', 'your/uns/topic', payloadJson, qos, retained)

```

For the payload, you could use a python dictionary and encode it as a json using jsonEncode.

```python
# Prepare the payload
payload = {}
payload['value'] = newValue.value
payload['quality'] = str(newValue.quality)			
payload['timestamp'] = system.date.format(newValue.timestamp, "yyyy-MM-dd HH:mm:ss.SSS")

payloadJson = system.util.jsonEncode(payload)

```

[https://docs.chariot.io/display/CLD80/MQTT+Publishing+via+MQTT+Engine](https://docs.chariot.io/display/CLD80/MQTT+Publishing+via+MQTT+Engine)

---

<div class="post-metadata">

**Author:** ![Joshua\_Hoekstra](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@Joshua\_Hoekstra](https://forum.inductiveautomation.com/u/Joshua_Hoekstra)\
**Post date:** [September 3, 2024, 2:24pm UTC](https://forum.inductiveautomation.com/t/how-to-connect-a-uns-to-the-mqtt-engine-and-or-mqtt-transmisson/95261/3 "2024-09-03T14:24:24Z")

</div>

Our company put built and UNS that is using Mosquito to push the data to central hub so they can overview all the plants at once. In side the UNS i can create a client that read the information that i send to them then that turns that information into a specific name structure that they want in the mqtt cloud.
