报错信息如下;
ERROR:asyncua.common.subscription:DataChange subscription created but handler has no datachange_notification method
上述报错原因在于创建监控句柄SubscriptionHandler类时,节点数据变化的函数名称有问题,不是默认的datachange_notification,我写的是data_change_notification
完整的监控句柄SubscriptionHandler类代码如下:
class SubscriptionHandler:
"""
The SubscriptionHandler is used to handle the data that is received for the subscription.
"""
def datachange_notification(self, node: Node, val, data):
"""
Callback for asyncua Subscription.
This method will be called when the Client received a data change message from the Server.
"""
print(node, val, data)
def event_notification(self, event: Event):