Skip to content

Triggering DataChangeEvent Only When Variant Value Changes #1545

Description

@chachawaiii

I have observed that in the current implementation of Free OPC UA, datachange events are only triggered when the Variant value of a node changes. This behavior raises a few questions and concerns:

1. Why is the datachange event only triggered by changes in the Variant value?
2. Why not compare the entire DataValue object to trigger the datachange event, including changes in the timestamp?
3. If I want to trigger datachange events when the timestamp of the DataValue changes, is the only solution to modify the set_attribute_value method in the Address_space?

I expected that a datachange event would be triggered when any part of the DataValue (including the timestamp) changes, not just when the Variant value changes.
Currently, the datachange event is only triggered if the Variant value changes, as shown in the code snippet:

if old.Value != value.Value:  # only send call callback when a value change has happened
    cbs = list(attval.datachange_callbacks.items())

Here is a brief description of the use case: In our application, we need to ensure that subscribers are notified not only when the value changes but also when the timestamp changes. This is important for certain monitoring and logging requirements where the timestamp itself is a critical piece of information.If applicable, here is a code snippet demonstrating the current behavior and a potential modification:

# Current behavior
if old.Value != value.Value:  # only send call callback when a value change has happened
    cbs = list(attval.datachange_callbacks.items())

# Proposed change to trigger on any DataValue change
if old != value:  # trigger on any change in DataValue
    cbs = list(attval.datachange_callbacks.items())

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions