readme and fix in structured mode

This commit is contained in:
Wolfgang Hottgenroth
2022-02-22 17:15:33 +01:00
parent d44460bed5
commit 35087f89ca
4 changed files with 88 additions and 7 deletions

View File

@ -17,7 +17,7 @@ class OpcUaRequester(threading.Thread):
self.name = self.config['name']
self.url = self.config['url']
self.nodes = self.config['nodes']
self.delay = self.config['delay']
self.period = self.config['period']
self.timeout = self.config['timeout']
self.dataObjectType = self.config['type']
self.flat = self.dataObjectType == 'flat'
@ -49,7 +49,7 @@ class OpcUaRequester(threading.Thread):
logger.error(f"UaError in inner OPC-UA loop: {type(e)} {e}")
if not self.flat:
self.queue.put(dataObject)
await asyncio.sleep(self.delay)
await asyncio.sleep(self.period)
except asyncio.exceptions.TimeoutError as e:
self.stats.incOpcUaTimeouts()
logger.error(f"Timeout in inner OPC-UA loop")

View File

@ -6,10 +6,10 @@ from AbstractDataObject import AbstractDataObject
class StructuredDataObject(AbstractDataObject):
def __init__(self, topicPart):
super().__init__(topicPart)
self.keyValuePairs = []
self.keyValuePairs = {}
def add(self, key, value):
self.keyValuePairs.append({key: value})
self.keyValuePairs[key] = value
def getPayload(self):
return json.dumps(self.keyValuePairs)

View File

@ -11,10 +11,10 @@
"opcua": [
{
"enabled": "true",
"type": "flat",
"type": "structured",
"url": "opc.tcp://172.16.3.60:4840",
"name": "apl",
"delay": 1.0,
"period": 1.0,
"timeout": 1.0,
"nodes": [
{ "ns": 0, "n": "i=345", "d": "pv" },
@ -28,7 +28,7 @@
"type": "flat",
"url": "opc.tcp://192.168.254.5:4863",
"name": "sh",
"delay": 1.0,
"period": 1.0,
"timeout": 10.0,
"nodes": [
{ "ns": 1, "n": "s=t|SERVER::A201CD124/MOT_01.AV_Out#Value", "d": "A201CD124" },