Implementing oldValue and newValue Functionality for MultiState Buttons

hello community.

I want a 2 value MultiState button to get the last value (oldValue) and the new value (newValue) as it is interacted with. In conclusion, what I am looking for is that if the button does not change for some reason, either by loss of communication, firmware error, etc., it returns to the original state. returning to the previous state.

what is the best way to do this?

regards

If I understand correctly, you want your button to:

  1. Track the actual value (oldValue) of the tag it's controlling
  2. Attempt to write a new value (newValue) to the tag when it's pressed, and also display newValue in the button state
  3. If after some time, the actual value has not changed, reset the displayed state back to oldValue

Just wanted to clarify if this is what you're trying to accomplish or something different.

I think your solution will involve the optimistic writes setting, or maybe something that checks the value's current quality.

If enabled, written values will be applied to the Tag in Ignition immediately. Normally, the system must receive confirmation that a write was successful from the device before the Tag in Ignition's value would change. The Optimistic Writes property changes the behavior by assuming the write went through until the next read value or subscription update proves otherwise. Enabling this will make writes appear to execute much quicker.Works in conjunction with the OPC Optimistic Write Timeout property below. If the Tag in Ignition does not receive confirmation that the new write was successful within the timeout, the Tag will change back to the last known value. While in an ambiguous state, the Tag with have a quality of "Good (Provisional)" .

1 Like

perfect is just what I need, but in my case it is not an OPC Ua that I am dealing with but a feedback variable that I get from another machine.

regards.