-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e346ca9
commit 04c6a41
Showing
5 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
# coming soon! | ||
import asyncio | ||
import logging | ||
from asyncua import Client, ua | ||
|
||
logging.basicConfig(level=logging.WARNING) | ||
_logger = logging.getLogger('asyncua') | ||
|
||
async def main(): | ||
client = Client(url="opc.tcp://127.0.0.1:48010", timeout=8) | ||
await client.connect() | ||
|
||
method_parent = client.get_node("ns=7;s=Demo.CTT.Methods") | ||
method_node = client.get_node("ns=7;s=Demo.CTT.Methods.MethodIO") # the method just adds two Int32 numbers | ||
|
||
# always specify the correct VariantType! | ||
inarg1 = ua.Variant(20, ua.VariantType.UInt32) | ||
inarg2 = ua.Variant(13, ua.VariantType.UInt32) | ||
|
||
result = await method_parent.call_method(method_node, inarg1, inarg2) # the order of args matters! | ||
print(result) | ||
|
||
await client.disconnect() | ||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
aiofiles==0.7.0 | ||
aiosqlite==0.17.0 | ||
asyncua==0.9.14 | ||
cffi==1.14.5 | ||
cryptography==3.4.7 | ||
pycparser==2.20 | ||
python-dateutil==2.8.1 | ||
pytz==2021.1 | ||
six==1.16.0 | ||
sortedcontainers==2.4.0 | ||
typing-extensions==3.10.0.0 |