I would like to push a device state attribute change event during the DevRestart admin command executed on that device.
I try to do it in the init_device():
from tango import DevState
from tango.server import run
from tango.server import Device
class Clock(Device):
def init_device(self):
self.set_change_event("state", True, False)
self.set_state(DevState.ON)
self.push_change_event("state")
if __name__ == "__main__":
run((Clock,))
Indeed, it looks like this use case was not foreseen.
If you put the push_change_event() call in the always_executed_hook(), the event is sent correctly after a restart device or restart server (if you read an attribute/pipe or execute a command).
We have to see whether we could restore this event information in one of the Device_XImpl constructors instead, but we might need to store this information in some global variable instead of local ones.
If this is a blocking point for you, could you please create an issue on cppTango?