Conditions | 2 |
Total Lines | 15 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import sys |
||
22 | async def main(): |
||
23 | url = "opc.tcp://localhost:53530/OPCUA/SimulationServer/" |
||
24 | # url = "opc.tcp://olivier:olivierpass@localhost:53530/OPCUA/SimulationServer/" |
||
25 | async with Client(url=url) as client: |
||
26 | print("Root children are", await client.nodes.root.get_children()) |
||
27 | |||
28 | tag1 = await client.get_node("ns=2;s=Channel1.Device1.Tag1") |
||
29 | print(f"tag1 is: {tag1} with value {await tag1.read_value()} ") |
||
30 | tag2 = await client.get_node("ns=2;s=Channel1.Device1.Tag2") |
||
31 | print(f"tag2 is: {tag2} with value {await tag2.read_value()} ") |
||
32 | |||
33 | handler = SubHandler() |
||
34 | sub = await client.create_subscription(500, handler) |
||
35 | handle1 = await sub.subscribe_data_change(tag1) |
||
36 | handle2 = await sub.subscribe_data_change(tag2) |
||
37 | |||
45 |