本文整理汇总了Python中status.Status.set_leaving方法的典型用法代码示例。如果您正苦于以下问题:Python Status.set_leaving方法的具体用法?Python Status.set_leaving怎么用?Python Status.set_leaving使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类status.Status
的用法示例。
在下文中一共展示了Status.set_leaving方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Status
# 需要导入模块: from status import Status [as 别名]
# 或者: from status.Status import set_leaving [as 别名]
for MAC_ADDRESS in phone_macs:
logger.log(logging.DEBUG, 'Registered mac address as phone: ' + MAC_ADDRESS)
status = Status()
while True:
try:
time.sleep(15)
if datetime.datetime.now().hour > wake_time:
if check_for_mac_addresses(phone_macs):
if status.is_away():
logger.log(logging.DEBUG, 'Lights powered up and set to home mode')
power_lights('on')
status.set_home()
elif status.is_leaving():
logger.log(logging.DEBUG, 'Returned before full shutoff delay time, set back to home mode')
status.set_home()
else:
if status.is_home():
logger.log(logging.DEBUG, 'Initiated leaving protocol, countdown to shutdown started')
status.set_leaving()
elif status.is_leaving() and abs((status.departure_time - datetime.datetime.now()).total_seconds()) > shutoff_delay:
logger.log(logging.DEBUG, 'Lights powered down and went to away mode')
power_lights('off')
status.set_away()
except Exception as e:
logger.error(e)