本文整理汇总了Python中ouimeaux.environment.Environment.list_motions方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.list_motions方法的具体用法?Python Environment.list_motions怎么用?Python Environment.list_motions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ouimeaux.environment.Environment
的用法示例。
在下文中一共展示了Environment.list_motions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from ouimeaux.environment import Environment [as 别名]
# 或者: from ouimeaux.environment.Environment import list_motions [as 别名]
import time
import ouimeaux
from ouimeaux.environment import Environment
# http://pydoc.net/Python/ouimeaux/0.7.3/ouimeaux.examples.watch/
if __name__ == "__main__":
print("")
print("WeMo Randomizer")
print("---------------")
env = Environment()
# TODO: run from 10am to 10pm
try:
env.start()
env.discover(100)
print(env.list_switches())
print(env.list_motions())
print("---------------")
while True:
# http://stackoverflow.com/questions/306400/how-do-i-randomly-select-an-item-from-a-list-using-python
switchRND = env.get_switch( random.choice( env.list_switches() ) )
print(switchRND)
switchRND.toggle()
env.wait(90)
except (KeyboardInterrupt, SystemExit):
print("---------------")
print("Goodbye!")
print("---------------")
# Turn off all switches
for switch in ( env.list_switches() ):
print("Turning Off: " + switch)
示例2: Environment
# 需要导入模块: from ouimeaux.environment import Environment [as 别名]
# 或者: from ouimeaux.environment.Environment import list_motions [as 别名]
import time
import ouimeaux
from ouimeaux.environment import Environment
# http://pydoc.net/Python/ouimeaux/0.7.3/ouimeaux.examples.watch/
if __name__ == "__main__":
print ""
print "WeMo Randomizer"
print "---------------"
env = Environment()
# TODO: run from 10am to 10pm
try:
env.start()
env.discover(100)
print env.list_switches()
print env.list_motions()
print "---------------"
while True:
# http://stackoverflow.com/questions/306400/how-do-i-randomly-select-an-item-from-a-list-using-python
switchRND = env.get_switch( random.choice( env.list_switches() ) )
print switchRND
switchRND.toggle()
env.wait(90)
except (KeyboardInterrupt, SystemExit):
print "---------------"
print "Goodbye!"
print "---------------"
# Turn off all switches
for switch in ( env.list_switches() ):
print "Turning Off: " + switch
示例3: SubscriptionRegistry
# 需要导入模块: from ouimeaux.environment import Environment [as 别名]
# 或者: from ouimeaux.environment.Environment import list_motions [as 别名]
import time
from datetime import datetime
from pyhue import Hue
from ouimeaux.environment import Environment
from ouimeaux.subscribe import SubscriptionRegistry
registry = SubscriptionRegistry()
env = Environment(with_cache=False)
env.start()
env.discover(3)
ms = env.list_motions()
ss = env.list_switches()
m = ms[0]
m = env.get_motion(ms[0])
ss = [env.get_switch(s) for s in ss]
h = Hue()
ls = h.lights
print ls
sunset = dict(sofa = [0.5543, 0.4098],
room = [0.5452, 0.4164],
bed = [0.5848, 0.3872],
desk = [0.5413, 0.4193])