Configure attribute polling on the server side

Dear all,
I have a simple question. In a python Tango device how can I configure polling for an attribute (period, turn on/off polling)? For standard attribute I can set the polling when creating them in the init_device:

myattr= attribute(…, polling_period=3000, …)

What should I do to set polling for State & Status attributes at initialization or if I want to reconfigure polling for some standard attributes after init_device()?

Probably this question was answered in the past, so forgive me if I ask again.

Many thanks,

Simone

Hi Simone,

Have you got the solution to set polling for State & Status attributes at initialization in Python/PythonHL code?
I am also trying to set polling for State & status command in PythonHL code. I am trying to resolve the issue posted on Tango Forum here: Polling of the state is not implemented · Issue #53 · tango-controls/pogo · GitHub

Thanks.

Regards,
Snehal

Hi all,

I have tested two options to solve that:

First, setting polling for state is as easy as adding this line to init_device(self) method:

    def init_device(self):
        Device.init_device(self)
        # PROTECTED REGION ID(TestHL.init_device) ENABLED START #
>>>>    self.poll_command('State',3000)
        # PROTECTED REGION END #

I will ask if it’s possible to have this line added by Pogo for python classes.

But, if you just want to have events for state; you can have them without polling adding these lines:


    at init_device():

        self.set_change_event('State',True)

    at each set_state() call:

        self.set_state(state)
        self.push_change_event('State')


I hope these recipes solve your question,

Sergi

Thanks for investigating and the detailed answer, Sergi!

Anton.