Hi
I made a simple python script to get the updated value of my PV
with a simple callback function :
import epics
import time
def onChanges(**kw):
print ('PV Changed! ', kw["pvname"], kw["value"], kw["units"], time.ctime())
mypv = epics.PV("TCU6:RF")
mypv.add_callback(onChanges)
while True:
pass
The issue is that the unit is shown as None even if it defined in the .db
PV Changed! TCU6:RF -39.69 None Mon Sep 9 15:03:58 2019
PV Changed! TCU6:RF -39.73 None Mon Sep 9 15:03:59 2019
PV Changed! TCU6:RF -39.71 None Mon Sep 9 15:04:00 2019
PV Changed! TCU6:RF -39.7 None Mon Sep 9 15:04:01 2019
PV Changed! TCU6:RF -39.67 None Mon Sep 9 15:04:02 2019
But if I add this line on the script before to add the callback
……
mypv.units
mypv.add_callback(onChanges)
……
Then when I restart the script it shows the unit correctly
PV Changed! TCU6:RF -39.79 dBm Mon Sep 9 15:04:31 2019
PV Changed! TCU6:RF -39.71 dBm Mon Sep 9 15:04:32 2019
PV Changed! TCU6:RF -39.69 dBm Mon Sep 9 15:04:33 2019
Is this a bug/feature or I am doing something wrong ?
Thanks
Best
PhD Alfio Rizzo
Control System Integrator
Integrated Control Systems Division
European Spallation Source ERIC
Telephone: +46(0)721792342
Mail Address: P.O Box 176, SE 221 00 Lund, Sweden
Visiting address: Odarslövsvägen 113, Lund
https://europeanspallationsource.se/