Hi
Hopefully an easy question. I want a device that only updates clients via ZMQ events, with no need for polling (this is assumed to be more efficient). However, I also want to archive all changes to the attribute values to HDB++.
Is the code below the correct pattern to follow? Specifically, for each attribute we need to call “set_change_event” and “set_archive_event” initially. And then for each attribute we need to call both “push_change_event” and “push_archive_event” whenever the attribute reading changes? I assume just using “push_change_event” would not be enough to get the values to HDB++.
class MyDevice(Device):
def init_device(self):
super().init_device()
self.set_change_event("attr1", True, True) # (flags not important)
self.set_archive_event("attr1", True, True)
def update_attribute(self, new_value):
self.attr1_value = new_value
push_change_event("attr1", self.attr1_value) # (could include time and quality)
push_archive_event("attr1", self.attr1_value)
That seems to be the pattern used here: tango-facadedevice/facadedevice/utils.py at 37b39f7b8b8e8dabf9223efd359abb5047a6fd38 · MaxIV-KitsControls/tango-facadedevice · GitHub
Thanks,
Anton