thermostat.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:thermostat_ita 作者: jpnos26 项目源码 文件源码
def check_pir( pin ):
    global minUITimer
    global lightOffTimer
    with thermostatLock:
        if GPIO.input( pirPin ): 
            log( LOG_LEVEL_INFO, CHILD_DEVICE_PIR, MSG_SUBTYPE_TRIPPED, "1" )

            if minUITimer != None:
                  Clock.unschedule( show_minimal_ui )
                  if lightOffTimer != None:
                    Clock.unschedule( light_off )   
            minUITimer = Clock.schedule_once( show_minimal_ui, minUITimeout ) 
            lighOffTimer = Clock.schedule_once( light_off, lightOff )   
            ignore = False
            now = datetime.datetime.now().time()

            if pirIgnoreFrom > pirIgnoreTo:
                if now >= pirIgnoreFrom or now < pirIgnoreTo:
                    ignore = True
            else:
                if now >= pirIgnoreFrom and now < pirIgnoreTo:
                    ignore = True

            if screenMgr.current == "minimalUI" and not( ignore ):
                screenMgr.current = "thermostatUI"
                log( LOG_LEVEL_DEBUG, CHILD_DEVICE_SCREEN, MSG_SUBTYPE_TEXT, "Full" )

        else:
            log( LOG_LEVEL_DEBUG, CHILD_DEVICE_PIR, MSG_SUBTYPE_TRIPPED, "0" )

# connect with oregon scientific and check inside outside temperature
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号