Dear Supporters,
in our community we need to count on, let’s call it, sort of “exotic” hardware cards/devices which do not support OPC-UA connections nor any one of the predefined in the OPC standard connections provided by Ignition. Therefore, we want to explore the potential of MQTT for this aim. Because of the nature of the hardware we have, we won’t be able to set a standard MQTT architecture, with an Ignition-edge connecting to the hardware through the transmission module, so we will have a certain linux machine which will run a python script connecting the the Ignition gateway instance which has both, the MQTT server and the engine. Take into account, that for our particular case, the hardware will provide us with just 5 topics. So, I can perfectly retrieve these 5 values, let’s say it, by hand. I have therefore several questions:
- Is this approach possible and recognised by Ignition?. This means, can I publish topics into the broker with a python script and the engine module available in the gateway will still be able to subscribe to the mentioned topics and create the corresponding tags?
- What is the broker_address to provide into the code?. I am just trying the following initial code:
import os, sys
import paho.mqtt.client as mqtt
broker_address=“ip_address_of_the_machine_hosting_the_gateway”
client = mqtt.Client(“P1”)
client.connect(broker_address)
client.publish(“house/main-light”,“OFF”)
However when I run it it tells me “socket.error: [Errno 111] Connection refused”, so it is failing at the connect level. Therefore the question is, how can I connect to the MQTT server that I have installed using the corresponding module in Ignition, using an external python script? (btw, just for testing, the python script I am creating is being executed in the same machine where the MQTT server and the gateway are installed, so I do not have any firewall issue).
Thank you very much for your help,
Patricia