thermostat.py 文件源码

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

项目:RaspberryPiThermostat 作者: scottpav 项目源码 文件源码
def reloadSchedule():
    with scheduleLock:
        schedule.clear()

        activeSched = None

        with thermostatLock:
            thermoSched = JsonStore( "thermostat_schedule.json" )

            if holdControl.state != "down":
                if heatControl.state == "down":
                    activeSched = thermoSched[ "heat" ]  
                    log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "heat" )
                elif coolControl.state == "down":
                    activeSched = thermoSched[ "cool" ]  
                    log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "cool" )

                if useTestSchedule: 
                    activeSched = getTestSchedule()
                    log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "test" )
                    print "Using Test Schedule!!!"

        if activeSched != None:
            for day, entries in activeSched.iteritems():
                for i, entry in enumerate( entries ):
                    getattr( schedule.every(), day ).at( entry[ 0 ] ).do( setScheduledTemp, entry[ 1 ] )
                    log( LOG_LEVEL_DEBUG, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_TEXT, "Set " + day + ", at: " + entry[ 0 ] + " = " + str( entry[ 1 ] ) + scaleUnits )


##############################################################################
#                                                                            #
#       Web Server Interface                                                 #
#                                                                            #
##############################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号