I am using MQTT Engine 4.0.21 and MQTT Distributer 4.0.21 installed on an Ignition gateway v8.1.17.
Ignition gateway web page Config\MQTT Engine\Settings I find custom namespaces. Inside each custom namespace I can enter topics under “Subscriptions”
“Comma separated list of topics the the MQTT server will subscribe on”
My questions are:
What is the max number of comma separated topics in a single custom namespace?
and
What is the max number of custom namespace rows can I have using MQTT Distributer as broker on the same gateway?
We don’t have a hard cap on the size. I’d guess the limit is really set by the max allowable String size for that field in Ignition. How many are you using or wanting to use and are you seeing an issue?
We don’t set a limit on the number of rows either. I would guess this is limited based on disk-size because it lives in the internal Ignition DB. I suppose once you got many millions of rows you’d probably see queries get a bit slow…
I am pretty new to MQTT but have years experience with Ignition. I have connected edge devices to Ignition using Engine and Distributer but have never had a need to use custom namespaces.
We have an assembly line with almost 200 stations. The line is equipped with MES software which publishes to an MQTT broker, but as of now its my understanding I will have zero control over the MES publishing namespace/topic arrangements.
Attached is an example. Subscribing to all topics causes engine to fail for parsing. I understand why. The rule of an MQTT broker topics are not the same as Ignitions tag space. The topic ‘production’ has 2 items below which is not allowed in Ignition tags.
I have toyed around in engine and can get the topics under production to come into MQTT Engine tag provider using custom namespaces, but am not thrilled about setting up hundreds of them. Maybe there is a more appropriate way to transform the MES MQTT namespace? Even if I can enter hundreds of custom topic subscriptions, would it be performant to do so?
Finally, I read in the docs MQTT Engine setup can be scripted. system.cirruslink.engine.createConfig() can define custom namespaces programmatically?
I have a lot of questions but Ill stop for now. I have a development environment where I can run tests, but not on hundreds of stations. Hopefully the picture comes through, I am not adept at forums.
Can you use wildcards in your subsubription? Without knowing all of the details of the topic namespace these clients are using, something like this may work:
+/production/#
As for programmatic creation of custom namespaces, yes - this can be done. See here for more details: ME: Python Scripting - MQTT Modules for Ignition 8.x - Confluence
Thank you I will try your suggestion.
props = {}
props['Id'] = 20
props['Name'] = 'scriptCon_00'
props['Subscription'] = 'topic\topics\topicss'
props['QoS1'] = False
props['RootFolder'] = 'scriptFolder'
props['TagName'] = 'scriptTag'
props['JsonPayLoad'] = True
props['Charset'] = 'UTF_8'
props['WritableTags'] = False
system.cirruslink.engine.createConfig("Cust Namespace", props)
Ran from script console returns “Invalid configuration key”.
Can you help?
JsonPayLoad
should be:
JsonPayload
Also, the slashes in MQTT topics must be forward slashes - not backslashes.
Thank You! I got it to work.
I’ve lost a lot of hours of my life to syntax…
I will execute a more thorough test. Ill let you know how it goes.
1 Like
I have done some light testing and things are going ok. I did realize something which would put the entire problem to bed. Occasionally the payloads I am receiving contain null. If the JSON parser could handle null, the collisions in my payloads would not take place.
Is there plans to have MQTT Engine JSON parser handle null?
If not, is there a technical reason why null could not just always be a String with value ‘null’?
The problem with this is the datatype for what is null now might not be next time - and it may be the case that it is actually a float - not a string. We don’t really want to be changing the datatype of tags.
For situations like this, many people don’t use the built-in JSON parsing and do it on their own. For example, uncheck the ‘JSON Payload’ option in the custom namespace config. Then set up a tag change script to parse and do what you want with the data. This could be creating more discrete tags and MQTT Engine does or whatever you need to do at that point.
I understand the challenges. Thank you.