本文整理汇总了Python中ouimeaux.environment.Environment.list_bridges方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.list_bridges方法的具体用法?Python Environment.list_bridges怎么用?Python Environment.list_bridges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ouimeaux.environment.Environment
的用法示例。
在下文中一共展示了Environment.list_bridges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Environment
# 需要导入模块: from ouimeaux.environment import Environment [as 别名]
# 或者: from ouimeaux.environment.Environment import list_bridges [as 别名]
env = Environment(with_subscribers=False, with_cache=False)
env.start()
env.discover()
#env.wait(3)
found_wemos = False
for switch_name in env.list_switches():
for entry in config:
if switch_name == entry.get('wemo switch'):
# FIXME: log
print("Found Wemo: {}".format(switch_name))
button_switches[entry['button mac']] = env.get(switch_name)
found_wemos = True
for bridge_name in env.list_bridges():
bridge = env.get_bridge(bridge_name)
for light_name in bridge.bridge_get_lights():
for entry in config:
if light_name == entry.get('wemo light'):
light = Light('Garage North', bridge)
# FIXME: log
print("Found Wemo: {}".format(switch_name))
button_switches[entry['button mac']] = light
found_wemos = True
for entry in config:
if entry.get('email to'):
email_switches[entry['button mac']] = Email(entry['email to'])
if found_wemos or email_switches: