opcua-with-python/opcua2mqtt/StructuredDataObject.py
2022-02-09 18:07:11 +01:00

16 lines
382 B
Python

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