gpt4 book ai didi

python - 在 Python Openzwave 上设置轮询间隔

转载 作者:太空宇宙 更新时间:2023-11-04 03:26:53 34 4
gpt4 key购买 nike

如何在 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()

此处重置为默认值

最佳答案

来自inline documentation of python-openzwave's network.py ,函数不是set_polling_interval,而是实际上

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

毫秒在哪里

[the] length of the polling interval in milliseconds

bIntervalBetweenPolls 是一个 bool 值,它

[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.

关于python - 在 Python Openzwave 上设置轮询间隔,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32696095/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com