#!/usr/bin/env python
-from pcaspy import Driver, SimpleServer
+from pcaspy import Driver, SimpleServer, Alarm, Severity
from opus20 import Opus20, OPUS20_CHANNEL_SPEC, PickleStore, Opus20ConnectionException
pvdb = {
'Temperature' : {
'prec' : 3,
+ 'unit' : 'deg C',
+ 'lolo' : 17,
+ 'low' : 20,
+ 'high' : 28,
+ 'hihi' : 30,
#'scan' : 1,
},
'RelativeHumidity' : {
'prec' : 3,
+ 'unit' : '%',
+ 'lolo' : 30,
+ 'low' : 40,
+ 'high' : 60,
+ 'hihi' : 70,
#'scan' : 1,
},
'AbsoluteHumidity' : {
'prec' : 3,
#'scan' : 1,
+ 'unit' : 'g/m3',
+ 'low' : 5,
+ 'high' : 20,
},
'Dewpoint' : {
'prec' : 3,
+ 'unit' : 'deg C',
#'scan' : 1,
+ 'lolo' : -30,
+ 'low' : -10,
+ 'high' : 16,
+ 'hihi' : 20,
},
'BatteryVoltage' : {
'prec' : 3,
+ 'unit' : 'V',
+ 'lolo' : 5.0,
+ 'low' : 5.3,
+ 'high' : 6.2,
+ 'hihi' : 6.5,
#'scan' : 1,
},
}
'Dewpoint': 0x006e,
'BatteryVoltage': 0x2724,
}
- value = self.o20.channel_value(mapping[reason])
+ try:
+ value = self.o20.channel_value(mapping[reason])
+ self.setParamStatus(reason, Alarm.NO_ALARM, Severity.NO_ALARM)
+ self.setParam(reason, value)
+ except:
+ self.setParamStatus(reason, Alarm.COMM_ALARM, Severity.MINOR_ALARM)
+ value = self.getParam(reason)
else:
value = self.getParam(reason)
+
return value
if __name__ == '__main__':