OPCUA Subscription with Kepware lost after few days #1647
Unanswered
mpdilipanchakravarthy
asked this question in
Q&A
Replies: 1 comment 6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We have subscribing to the kepware tags using the library and it is working fine for few days, then after few days - batch subscription is lost and data change event is not working, and this happens to loss in the data
Kepware is configured with boolean tag and it goes from false to true and stays in true for 5 seconds and goes to false , depending on the process completion and this tag is subscribed for notification
Another heart beat tag which increases every one second from value 0 to 10 by incremental value one using kepware simulator ramp function, and python is subscribed to this tag for monitoring any issue with kepware.
Above tags are working perfectly fine for some time > 1 day, 7 days, 3 days, but randomly heartbeat monitoring batch event change is not working, and after reconnecting through script it works fine.
is there any setting we need to do in the library or in kepware to avoid this false disconnect issue?
from asyncua import Client, Node, ua
.....
heart_beat_tag = connection_configs.get("heart_beat_tag", "ns=2;s=Heartbeatsim.Heartbeatsim.tag.Heartbeat")
.....
nodes.append(client.get_node(heart_beat_tag))
# Create Subscription Handler class object
handler = SubscriptionHandler(client)
subscription = await client.create_subscription(2000, handler)
await subscription.subscribe_data_change(nodes)
....
class SubscriptionHandler:
client: Client = None
def init(self, c):
self.client = c
_logger.info("Client attribute set in the SubscriptionHandler class")
"""
The SubscriptionHandler is used to handle the data that is received for the subscription.
"""
async def datachange_notification(self, node: Node, val, data):
if str(node) == heart_beat_tag:
# update heart beat timestamp
global heart_beat_timestamp
heart_beat_timestamp = datetime.now()
Beta Was this translation helpful? Give feedback.
All reactions