当前位置: 首页>>代码示例>>Python>>正文


Python Light.time_off方法代码示例

本文整理汇总了Python中pytomation.devices.Light.time_off方法的典型用法代码示例。如果您正苦于以下问题:Python Light.time_off方法的具体用法?Python Light.time_off怎么用?Python Light.time_off使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pytomation.devices.Light的用法示例。


在下文中一共展示了Light.time_off方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Door

# 需要导入模块: from pytomation.devices import Light [as 别名]
# 或者: from pytomation.devices.Light import time_off [as 别名]
###################### DEVICE CONFIG #########################

d_foyer = Door('D1', sg)

m_family = Motion('D8', sg)
# Motion sensor is hardwired and immediate OFF.. Want to give it some time to still detect motion right after
m_family.delay_still(2*60) 

ph_sun = Location('35.2269', '-80.8433', tz='US/Eastern', mode=Location.MODE.STANDARD, is_dst=True)

# Turn on the foyer light at night when either the door is opened or family PIR is tripped.
l_foyer = Light((49, 3), (upb, d_foyer, m_family, ph_sun))
# After being turned on, turn off again after 2 minutes of inactivity.
l_foyer.delay_off(2*60)
# Turn off the light no matter what at 11:59pm
l_foyer.time_off('11:59pm')
# Do not turn on the light automatically when it is night time (indoor light)
# Only looks at dark for restricing the whether the light should come on
l_foyer.ignore_dark(True)

##################### USER CODE ###############################
#Manually controlling the light
l_foyer.on()
l_foyer.off()

# Loop control
def MainLoop(*args, **kwargs):
    print 'Im in a main loop!'
    if l_foyer.state == State.ON:
        l_foyer.off()
    else:
开发者ID:ssteinerx,项目名称:pytomation,代码行数:33,代码来源:instance-example.py


注:本文中的pytomation.devices.Light.time_off方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。