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
with payload "456".
When i change the value of "New Tag" to 567 like this:
I get this message in my PLC:
Any idea what is wrong here?
Is one side talking Sparkplug and the other side not?
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:
How do I know if Ignition maker is sparkplug or not? Ive just installed it, so its whatever the default is
It's probably Sparkplug. Change that setting to "Sparkplug payload B" and see if things work.
I tried to that but no difference...
Also hive MQ has a online MQTT subscribe tool, and the result is just as cryptical:
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
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.
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 to publish messages back to the broker.
That said, if your PLC supports Sparkplug B natively, that's [probably] the best way to go.
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
So... I feel like im onto something. I have created a namespace for all recieved messages (#).
Those are the messages i am publishing:
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.
I tried to change the encoding charset to all available options, but UTF_8 seems most correctly, even if it isnt.
Can you open the Script Console (via Tools menu) in the Designer and show the output from the following?
read_result = system.tag.readBlocking(["[MQTT Engine]test/sensor2"]).value
print("Result is: %s" % read_result)