introduced distinction between ID and name (like for Adjustables)

This commit is contained in:
2023-02-09 12:53:19 +01:00
parent 0254585a66
commit 2003e71626
3 changed files with 9 additions and 8 deletions
+3 -3
View File
@@ -11,9 +11,9 @@ MSG_MISSING_TYPE = "'type' channel field not found. Parse as 64-bit floating-poi
class BSSensor(Sensor):
def __init__(self, name, **kwargs):
super().__init__(name, **kwargs)
self.thread = thread = BSMonitorThread(name, self._collect)
def __init__(self, ID, **kwargs):
super().__init__(ID, **kwargs)
self.thread = thread = BSMonitorThread(ID, self._collect)
thread.start()
def get_current_value(self):
+3 -3
View File
@@ -4,9 +4,9 @@ from .sensor import Sensor
class PVSensor(Sensor):
def __init__(self, name, **kwargs):
super().__init__(name, **kwargs)
self.pv = PV(name)
def __init__(self, ID, **kwargs):
super().__init__(ID, **kwargs)
self.pv = PV(ID)
self._cb_index = None
+3 -2
View File
@@ -5,8 +5,9 @@ from .basesensor import BaseSensor
class Sensor(BaseSensor):
def __init__(self, name, units=None, aggregation=np.mean):
self.name = name
def __init__(self, ID, name=None, units=None, aggregation=np.mean):
self.ID = ID
self.name = name or ID
self.units = units
self.aggregation = aggregation
self._cache = []