|
@@ -1,4 +1,4 @@
|
|
|
-import asyncio
|
|
|
+#!/usr/bin/env python3
|
|
|
import redis
|
|
|
|
|
|
from asyncua import Client
|
|
@@ -22,7 +22,7 @@ def get_opc_data():
|
|
|
pool = redis.ConnectionPool(host=redis_ip, password='')
|
|
|
redis_conn = redis.Redis(connection_pool=pool)
|
|
|
|
|
|
- async with Client(url=opc_server_url) as client:
|
|
|
+ with Client(url=opc_server_url) as client:
|
|
|
i = 0
|
|
|
result_arr = {}
|
|
|
print(datetime.now().strftime('Start_time:%Y-%m-%d %H:%M:%S.%f'))
|
|
@@ -30,7 +30,7 @@ def get_opc_data():
|
|
|
try:
|
|
|
node = f"ns={ns};s={opc_point_arr[i]}"
|
|
|
tag = client.get_node(node)
|
|
|
- value = await tag.read_value()
|
|
|
+ value = tag.read_value()
|
|
|
# redis值
|
|
|
redis_conn.set(str(opc_point_arr[i]), str(value))
|
|
|
arr_key = node.split("=")
|