Help with Ignition as OPC UA server for python opc UA client using asyncio

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?

Thanks in advace.

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

Hello Kevin,

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

I am going to check if port is open or not as well.I use 62541.

Did you restart Ignition after making configuration changes?

Otherwise, yes, check your firewall etc... and maybe try a 3rd party client like UaExpert to verify.

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.

Restarting gives some intersting reposnse

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

BTW Kevin, do I need to change this as well?

Not unless your loopback connection to the Ignition OPC UA server is broken.

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).

1 Like

Fantastic, that worked.. tested using UaExpert.

Will check again with firewall enabled.

Adding an inbound rule is needed.and restarting of the gateway after any change to the server settings