在Python Openzwave上设置轮询间隔

时间:2015-09-21 13:08:37

标签: python z-wave

如何在Python-Openzwave上设置设备的轮询间隔。命令 network.set_polling_interval(time)似乎不会更改默认的轮询间隔

代码

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()  

这里似乎设置为指定的值

#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()

此处将其重置为默认值

1 个答案:

答案 0 :(得分:2)

inline documentation of python-openzwave's network.py开始,该功能不是set_polling_interval,而是实际

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

milliseconds

的位置
  

[轮询间隔的长度,以毫秒为单位

bIntervalBetweenPolls是一个布尔值,

  

[if]设置为true(通过SetPollInterval),pollInterval将散布在每个轮询之间(因此可能适合更小的m_pollInterval,如100,500或1,000)。如果为false,则库会尝试完成m_pollInterval中的所有民意调查。