Replies: 5 comments 8 replies
-
so you want do write a servers nodevalue from clientside (or serverside?) and the change of the value should not trigger a datachange notification? serverside writing without a notification is possible! from opcua import Server, ua
from time import sleep
server = Server()
var = server.get_objects_node().add_variable(0, "Test", 0.0, ua.VariantType.Float)
dv = ua.DataValue(ua.Variant(0.0, ua.VariantType.Float))
server.start()
count = 0.0
while 1:
sleep(1)
count += 0.1
#dv = ua.DataValue(ua.Variant(count, ua.VariantType.Float)) # this would trigger a datachange event!
dv.Value = ua.Variant(count, ua.VariantType.Float) #this does not trigger because the classinstance is still the same!
var.set_value(dv) |
Beta Was this translation helpful? Give feedback.
-
I have a follow-up question. Can I set the timestamps of the node somehow? When using the version which triggers a data change, I set the timestamp like this:
when I want to suppress the datachange-notification, I don't know how to set my own timestamp. |
Beta Was this translation helpful? Give feedback.
-
https://reference.opcfoundation.org/v104/Core/docs/Part4/7.7.4/ python-opcua/opcua/common/node.py Line 195 in 1cca33d the only way to change timestamps without a notification is if you pass the same classinstance of what is the actual question do you get an error? |
Beta Was this translation helpful? Give feedback.
-
I start getting really confused about when you do want change events and when you don't. Can you describe the full picture? It seems a little inconsistent overall, or maybe I'm not getting the pieces together properly. |
Beta Was this translation helpful? Give feedback.
-
@starturtle the timestamp has nothing to do with the trigger of a notification its just an extra information about the age of the data. a notification is only triggert if the datavalue class instance changes if only a class prop change no notification is triggerd |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am currently converting a rest-API in xml-form to an opcua-server. In my fist version I only used subscriptions when I wanted to get a node value. Now I need a mixture of polling and subscribing. The problem, I want to set the node value for polling every 30 seconds and I dont want subscibed nodes to notice this change . When I subscribe a node from the client I take the sampling interval and set the value accordingly. Because the 30 seconds from polling and the sampling intervall are not fitting together the nodes from the subscription are set even when they are not supposed to.
Is there a way to set subscribed nodes seperated from the polling process?
Beta Was this translation helpful? Give feedback.
All reactions