Using MQTT Transmitter to Publish Tag Value

I’m working on using MQTT with ignition through the Cirrus Link modules. I currently have my Ignition server receiving tag values (from a DHT22 temp/humidity sensor) with no issues. What I’m now working on is trying to figure out how to transmit a tag value - in my case a pump value which is either 0 or 1. My module sends it just fine but it sends too much information and the ESP8266 that I’m using can’t decode the message being sent. I’d like to have the transmitter only send the tag value, ie. 0 or 1. Currently, it sends a whole bunch of tag properties along with it that can’t be decoded.

Here is what the transmitter is sending (decoded with the spark plug decoder):


Here is the same thing in plain text:

Pump�����. 8J

Finally, this is what the other end reads it as through the serial port:

Message arrived [spBv1.0/Plant/NDATA/Plant] ⸮⸮⸮⸮⸮.&
Pump⸮⸮⸮⸮⸮. 8

I’d like to just have ignition send the tag value and nothing more through the topic “spBv1.0/Plant/NDATA/Plant” so I don’t have any issues decoding. Is this possible?

You should probably be using a generic namespace and not a Sparkplug namespace if the two sides don’t both understand Sparkplug.

How would I go about doing this? Currently I’m using a custom namespace that subscribes to various topics. I don’t see anything to change from Sparkplug other than the Encoding Charset property and the JSON Payload property. search for “Custom Namespaces”.

Although now I seem to remember that tags from custom namespaces are read-only and you need to use the MQTT scripting calls to publish in that case.

I’m actually looking to have Ignition transmit a memory tag that I created. It isn’t receiving anything for that tag, it just needs to transmit its value. I don’t believe I even need to use namespaces in this case, only the transmitter module. It seems though the transmitter module only works with sparkplug though. I do see the filter property in the transmitter module, but I’m not sure how it works and couldn’t find any documentation online regarding its inputs.

I think you would want the engine module and this scripting function:

Thank you for the help, Kevin! For anyone else who may stumble across this having the same issue. I followed the tutorial Kevin posted but edited the scripting a bit to send the tag value rather than “hello world” when the tag value changes.

Here’s a copy of my script:

buff ="[MQTT Engine]Edge Nodes/Plant/Plant/Pump")

system.cirruslink.engine.publish("Chariot SCADA", "Pump", str(buff.value).encode(), 0, 0)
1 Like