mirror of
https://github.com/ivan-usov-org/bec.git
synced 2025-04-22 10:30:02 +02:00
fix: added option to read configuration from redis
This commit is contained in:
parent
abedd5e954
commit
f7acd4cb06
@ -336,12 +336,27 @@ class OphydInterfaceBase(RPCBase):
|
||||
return {obj_name: signals.get(obj_name, {})}
|
||||
return {key: val for key, val in signals.items() if key.startswith(self.full_name)}
|
||||
|
||||
@rpc
|
||||
def read_configuration(self):
|
||||
def read_configuration(self, cached=True):
|
||||
"""
|
||||
Reads the device configuration.
|
||||
|
||||
Args:
|
||||
cached (bool, optional): If True, the cached value is returned. Defaults to True.
|
||||
"""
|
||||
|
||||
if not cached:
|
||||
return self._run(cached=False, fcn=self.read_configuration)
|
||||
val = self.root.parent.producer.get(
|
||||
MessageEndpoints.device_read_configuration(self.root.name)
|
||||
)
|
||||
if not val:
|
||||
return None
|
||||
signals = messages.DeviceMessage.loads(val).content["signals"]
|
||||
if self._signal_info:
|
||||
obj_name = self._signal_info.get("obj_name")
|
||||
return {obj_name: signals.get(obj_name, {})}
|
||||
return {key: val for key, val in signals.items() if key.startswith(self.full_name)}
|
||||
|
||||
@rpc
|
||||
def describe(self):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user