I setup a basic codesys program containing variables with Symbol Configuration Object
I Setup a MQTT SpB Edge Node in Groov Manage/Data Services
I am not sure how to link my codesys tags to the MQTT Edge Node in Groov Manage?
I am sure I am missing something basic. I did try to setup an OPC UA server on Groov Manage/Data Services (also added hostname.local to network) but that does not seem to be the correct route. A point in the right direction will help a lot!
If you are using Codesys and you want to link tags to the native MQTT Sparkplug B client on the EPIC System, you need to write the Tags into OptoMMP areas, the so called Scratch Pad.
Here is a link with a guid how to do this: https://developer.opto22.com/codesys/mmp/
Basically you write your values from Codesys into Scratch Pad tables provided in the MMP (MemoryMap) area on the EPIC controller. Then you make this areas public using the I/O Services tool in groov Manage. Then configure the Data Service and add the EPIC IO as a scanned device in the Data Service configuration.
Thanks for the quick response, I will give it a go later today when I get a chance. Will this method be able to facilitate read and write between Codesys and anything else connected to the MQTT Broker (e.g. SCADA)?
Thanks, I was able to pull the tags into the scratchpad (MMP). I thought about it and realized it is perhaps better going the following route:
Codesys / OPCUA Node / MQTT SpB Node
It gives me more granular control.
If I can pull in @torchard , would you agree?
I tried installing node-red-contrib-opcua (v0.2.310) but I saw it needs node>v15. So I followed this post and had to go all the way back to v0.2.289. It installed but this is what I am now seeing in Node-RED:
It is at this point that I stopped and decided to quickly check in with you to confirm if I am on the right track because this is starting to feel like a recipe for multi-day troubleshooting.
Both Terry and I cannot recommend this approach.
As you have discovered the OPCUA node is very difficult to install and use and you will find the same, but possibly worse with the MQTT Sparkplug node.
ie, you are doubling your trouble for zero gain.
Using the MMP and native Data Services is the correct path to take.
If you have the data in MMP tables, you are just a few clicks away from publishing via the native MQTT client. While going Node-RED from there sounds complicated.
Ok thanks, there are a couple of reasons why the Node Red route will work better for us outside of just gettings comms between Codesys and MQTT SpB. But given what Beno said, I also agree that it is perhaps better to not go that route then.
I have codesys communicating via the Scratchpad (Thanks @gerhardK ). The only issue I still have is that the Opto MQTT SpB client stays in a “Waiting” state, seems like it is waiting for Ignition (The Primary Host):
Waiting for a primary host 2.0 STATE to be published
I removed the primary host requirement (for now) and now it works. I will play around with it a bit more later to determine which MQTT client is at fault (Ignition or Opto) as primary host is a requirement.
If you are using the Primary Host ID in the MQTT settings on the EPIC, you need a subscriber that subscribes on the Primary Host ID.
The Primary Host ID will inform the broker if it is accepting connections or not, if you don’t have any other subscribers with the EXACT same Primary Host ID, then the broker will reject your clients connection and no data will be published.
What is subscribing to the broker to get the data from the EPIC? The subscriber needs to support the Primary Host ID.
Which broker are you using?
If you go the Ignition route, you can test with MQTT Distributor as the broker and MQTT Engine as the subscriber.
I came right with the primary host feature, it seems like Ignition engine module now uses primary host 3.0. So I simply had to set the Opto unit to the same version.
@gerhardK In the manual I found:
“If you are switching from PAC Control Engine to CODESYS Runtime Engine, your PAC Control
strategy will be erased and Sparkplug will be disabled”
Is this correct? We want to build a program in CODESYS and publish MQTT Sparkplug B messages to our broker.
Yes, the manual is correct.
If you want to use use Codesys and MQTT, just put the values you want from Codesys in the MMP scratchpad and publish them.
All that changes is that since you are not running PAC Control, the native groov Manage data service cant send the PAC Control tags.
Codesys is not our software and there is no way to get the tags in and out of Codesys, so we have use the MMP scratchpad as a middle man to pass messages back and forth between MQTT SparkplugB and Codesys.
We have many customers using it this way.