MQTT setpoint control

Short version: I’m working on a project where I want to control inbound MQTT messages to the EPIC based on a physical input to the device. Is there a way to locally control the when the EPIC receives setpoints and other data from the Broker?

Long Version: We’re replacing an older PLC at a site, and the system has an existing Remote/Local control switch, used to allow the Operators to remotely control which pumps are running. However, we’re moving to use a different communication method: MQTT. I would still like to integrate the existing Local/Remote Switch if possible. I want the local EPIC to stop processing setpoints and other commands from MQTT when the switch is in local, and only take those setpoints from the Groove View display on site. If the switch is in remote, then use the latest command weither it comes from Groove View or MQTT. We are using CODESYS for control, and Ignition Edge to provide the MQTT connection back to a Full Ignition Server with Cirrus Link modules for Broker, etc. Is there any easy setting we could just turn on and off to do this? I did look but couldn’t find anything so far.

From a high level, yes, very do-able.
Specific or pseudo code… I am not sure I can help since I am weak in Codesys. @greichert might be able to guide some specific options there if needed, but see how you go with this description…

You will need to make use of the MMP scratch pad. Not sure how much work you have done in that, but its a great way to pass information between different parts of EPIC and RIO.

Your digital input, local/remote switch will have an MMP address, so you can pick that or the state directly in Codesys.
MQTT can pub sub MMP addresses, so that is your remote set point. You won’t turn it off, it will always sub to the remote broker / set point. You will just chose to use it or ignore it.
groov View can read and write from MMP, so there is your local set point that either Codesys can use or ignore.
Ignition can read and write from MMP, so there is your last part of the task.

So, in Codesys it becomes a matter of reading the digital input status, 1 or 0 and from there choose which set point source to write, the MMP from MQTT, or the MMP from your HMI.

2 inputs, 1 output with a rotary switch in the middle selecting which to use.

Make sense?

Yeah, I knew I could do something like that. I could do it in CODESYS that way too. Just a function block with multiple inputs and one output. However, I was hoping to find a setting for MQTT that the client (not broker) uses to say that it is writing only, reading only, or both reading and writing. I also want the local changes to always show up in MQTT at the main Ignition site, so that’s a factor too.

Maybe I should ask Cirrus Link?