2

How can I set a polling interval for devices on Python-Openzwave. The command network.set_polling_interval(time) does not seem to change the default polling interval

Code

network = ZWaveNetwork(options, autostart=False)

dispatcher.connect(louie_network_started,ZWaveNetwork.SIGNAL_NETWORK_STARTED)
dispatcher.connect(louie_network_failed, ZWaveNetwork.SIGNAL_NETWORK_FAILED)
dispatcher.connect(louie_network_ready, ZWaveNetwork.SIGNAL_NETWORK_READY)


network.start()
network.set_poll_interval(1000)
print network.get_poll_interval()  

Here it seems to be set to the value specified

#We wait for the network.
#print "***** Waiting for network to become ready : "
for i in range(0,90):
if network.state>=network.STATE_READY:
    #print "***** Network is ready"
    break
else:
    #sys.stdout.write(".")
    #sys.stdout.flush()
    time.sleep(1.0)


 print network.get_poll_interval()

Here its reset to the default value

1 Answers1

2

From the inline documentation of python-openzwave's network.py, the function is not set_polling_interval, but actually

def set_poll_interval(self, milliseconds=500, bIntervalBetweenPolls=True):

Where milliseconds is

[the] length of the polling interval in milliseconds

and bIntervalBetweenPolls is a boolean, which

[if] set to true (via SetPollInterval), the pollInterval will be interspersed between each poll (so a much smaller m_pollInterval like 100, 500, or 1,000 may be appropriate). If false, the library attempts to complete all polls within m_pollInterval.

Robin James Kerrison
  • 1,727
  • 1
  • 15
  • 26
  • Thanks for the reply. I actually meant set_poll_interval . What happens s, it is changed to the value I want, but then it automatically switches back to the default. I checked this by printing the output from network.get_poll_interval(). Any reason why this would happen? – Ashish Mudaliar Sep 23 '15 at 09:40
  • Could you update with more code showing where you set it and where it appears to be reset to default? – Robin James Kerrison Sep 23 '15 at 10:04