Total Complexity | 2 |
Total Lines | 25 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import sys |
||
2 | sys.path.insert(0, "..") |
||
3 | import logging |
||
4 | import asyncio |
||
5 | |||
6 | from IPython import embed |
||
7 | |||
8 | from asyncua import Client |
||
9 | from asyncua import ua |
||
10 | |||
11 | |||
12 | |||
13 | async def main(): |
||
14 | logging.basicConfig(level=logging.WARN) |
||
15 | async with Client("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer") as client: |
||
16 | struct = client.get_node("ns=2;i=10239") |
||
17 | before = await struct.read_value() |
||
18 | data = await client.load_type_definitions() # scan server for custom structures and import them |
||
19 | after = await struct.read_value() |
||
20 | print("BEFORE", before) |
||
21 | print("AFTER", after) |
||
22 | |||
23 | if __name__ == '__main__': |
||
24 | asyncio.run(main()) |
||
25 |