asyncua is a comprehensive, pure Python library providing both OPC-UA client and server capabilities, designed for asynchronous operations. It enables Python applications to communicate with industrial automation systems using the OPC-UA protocol. Currently at version 1.1.8, the library maintains an active development pace, with frequent bug fixes and feature enhancements, including recent beta releases for upcoming major versions.
pip install asyncuaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to establish a basic OPC-UA client connection, retrieve the root node, and gracefully disconnect. It uses an environment variable for the server URL, which is a common practice for flexible deployment. Remember that `asyncua` is built on `asyncio`, so all client/server operations must be `await`ed within an `async` function.
Upgrade your Python environment to 3.10 or newer. For projects requiring older Python versions, stick to asyncua version 1.1.x or earlier.
Ensure all asyncua methods are called with `await`. For example, use `await client.connect()` instead of `client.connect()`.
Wrap client connection logic in `try...finally` to ensure `await client.disconnect()` is called, or preferably, use `async with Client(...) as client:` which handles connection and disconnection automatically.
When writing values, explicitly construct `ua.Variant` objects with the correct `VariantType` if the default conversion is not sufficient, e.g., `await node.write_value(ua.Variant(123, ua.VariantType.Int32))`.
Install the module using pip: 'pip install asyncua'.
Install the module using pip: 'pip install asyncio'.
Install the module using pip: 'pip install pyee'.
Install the module using pip: 'pip install pyserial-asyncio'.
Install the module using pip: 'pip install nest-asyncio'.
No dependency data recorded yet.