本文整理匯總了Python中status.Status.is_away方法的典型用法代碼示例。如果您正苦於以下問題:Python Status.is_away方法的具體用法?Python Status.is_away怎麽用?Python Status.is_away使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類status.Status
的用法示例。
在下文中一共展示了Status.is_away方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Status
# 需要導入模塊: from status import Status [as 別名]
# 或者: from status.Status import is_away [as 別名]
logger=logging.getLogger(__name__)
logger.log(logging.DEBUG, 'Started script')
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()