diff --git a/etc/test.cfg b/etc/test.cfg index f30bb51..eac6fae 100644 --- a/etc/test.cfg +++ b/etc/test.cfg @@ -1,5 +1,5 @@ [server] -bindto=localhost +bindto=0.0.0.0 bindport=10767 interface = tcp framing=eol @@ -16,3 +16,7 @@ maxheaterpower=10 class=devices.test.Temp sensor="X34598T7" +[device epicspv] +class=devices.test.EPICS_PV +sensor="test_sensor" +max_rpm="very high" diff --git a/src/devices/test.py b/src/devices/test.py index c429868..613c13e 100644 --- a/src/devices/test.py +++ b/src/devices/test.py @@ -26,6 +26,7 @@ import random from devices.core import Readable, Driveable, PARAM from validators import floatrange +from epics import PV class LN2(Readable): """Just a readable. @@ -71,3 +72,23 @@ class Temp(Driveable): def write_target(self, target): pass + + + +class EPICS_PV(Driveable): + """pyepics test device.""" + + PARAMS = { + 'sensor': PARAM("Sensor number or calibration id", + validator=str, readonly=True), + 'max_rpm': PARAM("Maximum allowed rpm", + validator=str, readonly=True), + } + + def read_value(self, maxage=0): + p1 = PV('testpv.VAL') + return p1.value + + def write_target(self, target): + p1 = PV('test.VAL') + p1.value = target