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
****************************************************************
Simone Riggi
INAF, Osservatorio Astrofisico di Catania
Via S. Sofia 78
95123, Catania - Italy
phone: +39 095 7332 extension 282
e-mail: simone.riggi@gmail.com,
sriggi@oact.inaf.it
skype: simone.riggi
****************************************************************
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: https://github.com/tango-controls/pogo/issues/53

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
Keep on dancing,

http://www.tango-controls.org/resources/howto/how-fandango/
Edited 4 years ago
Thanks for investigating and the detailed answer, Sergi!

Anton.
 
Register or login to create to post a reply.