pvaPy icon indicating copy to clipboard operation
pvaPy copied to clipboard

pvaPy server listing all fields as 'changed' despite only updating value and timeStamp

Open kathryn-baker opened this issue 10 months ago • 3 comments

Hi there, I am unsure which of the two libraries is best to post this in as it could be a pvapy or a p4p issue but I thought I would post it here first, apologies if that's wrong!

I am running a PvaPy server and updating values internally within the server (see the code snippet below), in most cases only updating the value and timeStamp (see the code snippet below) fields (see the code snippet below).

...
            example_pv.set(
                {"value": start_val, "timeStamp": PvTimeStamp(time.time()).toDict()}
            )
            server.update(pvname, example_pv)
...

However, when I use p4p to monitor the PV, the changedSet seems to indicate that all of the fields have updated each time, which is not the case.

... 
def callback(val):
    print(val.changedSet(expand=False))
...
mon = c.monitor(pv_name, cb=callback)

Output:

{'display.limitLow', 'valueAlarm.highWarningSeverity', 'display.description', 'valueAlarm.highAlarmSeverity', 'valueAlarm.highWarningLimit', 'value', 'alarm.status', 'display.units', 'valueAlarm.hysteresis', 'timeStamp.secondsPastEpoch', 'timeStamp.nanoseconds', 'valueAlarm.highAlarmLimit', 'valueAlarm.lowWarningSeverity', 'timeStamp.userTag', 'alarm.message', 'valueAlarm.lowAlarmSeverity', 'valueAlarm.lowAlarmLimit', 'valueAlarm.active', 'display.limitHigh', 'alarm.severity', 'valueAlarm.lowWarningLimit', 'display.format'}

At the moment this isn't too much of an issue but we are hoping to write more applications where it would be easier to identify the changedSet based on the results of this call rather than the user having to compare field equality on the application end each time.

Is there something extra we need to do on the server side to get this call right or is it possibly a difference in how the two libraries communicate?

I've attached a more complete example of the issue in Docker as a .zip file below to better illustrate the issue but for reference I am using Python 3.10 on Debian Linux with pvapy==5.3.1 and p4p==4.1.12 example.zip

Thanks in advance for your help!

kathryn-baker avatar Apr 09 '24 15:04 kathryn-baker