I'm developing an application in PyQt5 with the aim of reading values from an OPC UA server and displaying them in real time. For now, I'm just testing the asyncua library with a simple example, before integrating the logic into the main application. The problem I'm facing is this: When I run the code, it only reads the initial value from the OPC node. I'm monitoring the variables with UAExpert and confirm that the values are being updated correctly on the server. However, during the execution of my program, these values are not updated on the display. Has anyone experienced something similar or know what might be missing for the real-time updates to work correctly? Thanks in advance for any help! The code: class SubHandler: def __init__(self, update_callback): self.update_callback = update_callback def datachange_notification(self, node, val, data): _logger.info(f"Data change on {node}: {val}") self.update_callback(node.nodeid.to_string(), val) class OPCWindow(QWidget): def __init__(self, node_ids): super().__init__() self.setWindowTitle("OPC UA Async Monitor") self.node_ids = node_ids self.labels = {} self.layout = QVBoxLayout() for i, node_id in enumerate(self.node_ids): label = QLabel() #QLabel(f"Value {i+1}: Loading...") self.labels[node_id] = label self.layout.addWidget(label) self.setLayout(self.layout) def update_value(self, node_id, value): if node_id in self.labels: self.labels[node_id].setText(f"{node_id} : {value}") async def main(): opc_url = "opc.tcp://192.168.1.100:4840" node_ids = ["ns=7;s=Tag_1", "ns=7;s=Tag_2"] app = QApplication(sys.argv) loop = QEventLoop(app) asyncio.set_event_loop(loop) window = OPCWindow(node_ids) window.show() async with Client(url=opc_url) as client: for node_id in node_ids: try: value = await client.get_node(node_id).read_value() window.update_value(node_id, value) except Exception as e: _logger.error(f"Error reading {node_id}: {e}") window.update_value(node_id, "Error") handler = SubHandler(window.update_value) subscription = await client.create_subscription(500, handler) nodes = [client.get_node(nid) for nid in node_ids] await subscription.subscribe_data_change(nodes) _logger.info("Subscription created and running.") with loop: await loop.run_forever() if __name__ == "__main__": asyncio.run(main()) What I hope to get out of it is to display the values in real time Continue reading...