コード例 #1
0
def alarm_is_on():
    '''Returns True is alarm is not in off of home mode.'''
    
    try:
        alarm = SimpliSafe()
        alarm.login(ALARM_USER, ALARM_PASSWORD)
        alarm.get_location()
        state = alarm.get_state()
        alarm.logout()
        state = state.lower()
        if state == 'off':
            return False
        if state == 'home':
            return False
        return True 
    except Exception as why:
        print "Error getting alarm status {0}".format(why)
        LOG.error('Error getting alarm status: {0}, assuming alrm is ON'.format(why))
        return True