def load_map_telemetry(self): # Load all the map map_telemetry = MapTelemetry(self.logger) map_telemetry.load_file() self.map_telemetry = map_telemetry.data return
async def run(): url = "opc.tcp://localhost:4840/Larouex-Industrial-Manufacturing/Server" map_telemetry_file = MapTelemetry(Log) map_telemetry_file.load_file() map_telemetry_data = map_telemetry_file.data config_file = Config(Log) config_file_data = config_file.data async with Client(url=url) as client: idx = await client.get_namespace_index(map_telemetry_data["NameSpace"]) print(idx) while True: await asyncio.sleep(config_file_data["ClientFrequencyInSeconds"]) for node in map_telemetry_data["Nodes"]: print(node["Name"]) for variable in node["Variables"]: print(variable["DisplayName"]) print(variable["TelemetryName"]) read_node = client.get_node(variable["NodeId"]) val = await read_node.get_value() print(val)
def update_map_telemetry(self): map_telemetry_file = MapTelemetry(self.logger) map_telemetry_file.update_file(self.map_telemetry) return