I wanted to conect python app to Ignition for ML based vision app with a goal of sending the results of vision app to PLC via Ignition.
I did find quite a few posts about that however i am stuck at the basic connection.
What I have done so far?
I have a simple python app using asyncio to connect to ignition opc us server
import asyncio
from asyncua import Client
url = "opc.tcp://10.x.y.z:pppp"
namespace = "ns1"
async def main():
print(f"Connecting to {url} ...")
async with Client(url=url) as client:
On Ignition gateway-->config-->opc ua server settings, I changed the endpoint to same IP address as in url and port as ppp.
I allowed annonymous access and exposed the tags.
But I can't seem to make connection. Any pointers or HowTos I can go through?
Is your Python client running on a different computer than the Ignition Gateway? Did you change the Bind Address setting from its default of localhost to something like 0.0.0.0?
Yes, client and server are on different address. I thought it could be firewall so I disbaled it to test and the error message changed from "Timeout" to below:
ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection
Yes, the bind address and endpoint are both 10.x.y.z
No I did not Kevin, restarting now. I created a inbound rule for tcp port. Is there anything else I need to allow? I rather not disable firewall completely and just opening inbound for 62541 tcp port with firewall enabled gives same error (timeout) versus firewall disabled.
updating client limits to: TransportLimits(max_recv_buffer=65535, max_send_buffer=65535, max_chunk_count=64, max_message_size=2097152)
disconnect_socket was called but connection is closed
Look at the logs in the Ignition Gateway now. You probably have Ignition configured to only allow secure connections but the Python client is trying to connect without security.
You'd have to change the Security Policies setting in the Ignition OPC UA server settings to None, Basic256Sha256 (and restart again).