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

**URL:** <https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [March 10, 2023, 12:15am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877 "2023-03-10T00:15:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![user5](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/user5/32/39393_2.png) [@user5](https://forum.inductiveautomation.com/u/user5)\
**Post date:** [March 10, 2023, 12:15am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/1 "2023-03-10T00:15:50Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 10, 2023, 12:54am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/2 "2023-03-10T00:54:14Z")

</div>

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`?

---

<div class="post-metadata">

**Author:** ![user5](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/user5/32/39393_2.png) [@user5](https://forum.inductiveautomation.com/u/user5)\
**Post date:** [March 10, 2023, 12:57am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/3 "2023-03-10T00:57:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![user5](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/user5/32/39393_2.png) [@user5](https://forum.inductiveautomation.com/u/user5)\
**Post date:** [March 10, 2023, 12:58am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/4 "2023-03-10T00:58:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 10, 2023, 1:01am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/5 "2023-03-10T01:01:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![user5](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/user5/32/39393_2.png) [@user5](https://forum.inductiveautomation.com/u/user5)\
**Post date:** [March 10, 2023, 1:15am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/6 "2023-03-10T01:15:13Z")

</div>

> [@Kevin.Herron](#):
>
> UaExpert

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.

---

<div class="post-metadata">

**Author:** ![user5](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/user5/32/39393_2.png) [@user5](https://forum.inductiveautomation.com/u/user5)\
**Post date:** [March 10, 2023, 1:21am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/7 "2023-03-10T01:21:42Z")

</div>

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?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8ad6634add8f7695937ace71ec81a41e2ad4788a.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 10, 2023, 1:22am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/8 "2023-03-10T01:22:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 10, 2023, 1:23am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/9 "2023-03-10T01:23:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![user5](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/user5/32/39393_2.png) [@user5](https://forum.inductiveautomation.com/u/user5)\
**Post date:** [March 10, 2023, 1:31am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/10 "2023-03-10T01:31:07Z")

</div>

Fantastic, that worked.. tested using UaExpert.

Will check again with firewall enabled.

---

<div class="post-metadata">

**Author:** ![user5](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/user5/32/39393_2.png) [@user5](https://forum.inductiveautomation.com/u/user5)\
**Post date:** [March 10, 2023, 2:42am UTC](https://forum.inductiveautomation.com/t/help-with-ignition-as-opc-ua-server-for-python-opc-ua-client-using-asyncio/70877/11 "2023-03-10T02:42:47Z")

</div>

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