當前位置: 首頁>>代碼示例>>Python>>正文


Python Light.ignore_dark方法代碼示例

本文整理匯總了Python中pytomation.devices.Light.ignore_dark方法的典型用法代碼示例。如果您正苦於以下問題:Python Light.ignore_dark方法的具體用法?Python Light.ignore_dark怎麽用?Python Light.ignore_dark使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pytomation.devices.Light的用法示例。


在下文中一共展示了Light.ignore_dark方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Motion

# 需要導入模塊: from pytomation.devices import Light [as 別名]
# 或者: from pytomation.devices.Light import ignore_dark [as 別名]
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:
        l_foyer.on()
        
開發者ID:ssteinerx,項目名稱:pytomation,代碼行數:30,代碼來源:instance-example.py


注:本文中的pytomation.devices.Light.ignore_dark方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。