Differentiating source of param change

Greetings,

Is there a way to know the source of a param change? I have widget controls on params that will process changes and send them to a networked device. However, if the settings on that device are changed outside of dashboard, I want to update the dashboard display to the new values. I am able to get a listener to process these messages, but if I set the params to new values via ogscript, this also triggers the changed events sending the updates back to the device and floods the network with unnecessary traffic.

I would like to find a way to have messages sent only when the user changes the values within dashboard, not when they are updated by code in the listener. Any suggestions?

#DashBoard​

Hi Ryan
There are several ways to try to get this workflow. One way is to have your own copy of the parameter that you use to display/update the device’s copy. You can listen for changes to the device’s parameter and, if your copy is being set to the same value as the device’s, you don’t write anything back to the device.

var deviceValue = params.getValue('Device_Parameter', 0); // get the device value ogscript.putObject('device-value', deviceValue); // store it so you know it came from the device params.setValue('My_Parameter', 0, deviceValue); // update your display parameter if (this.getValue() != ogscript.getObject('device-value')) { ogscript.debug("I updated the parameter"); params.setValue('Device_Parameter', 0, this.getValue()); } ​

Hey James,
Thanks for the reply. That’s the direction I was thinking I had to go. Just wanted to check to make sure I wasn’t missing some other way of change handling within dashboard that wouldn’t require the extra parameters and objects. I appreciate the code sample!