def rotate(): """Rotate the camera. Need to pause the camera process otherwise rotating will trip motion detection due to a vastly different image. Returns: str: Response to slack """ data = utils.parse_slash_post(request.form) args = data['text'].split() if len(args) != 2: return ("Incorrect input. Please provide as two integers separated by " " a space. i.e. '0 0'") try: pan = int(args[0]) tilt = int(args[1]) except ValueError: return 'Did not receive integer arguments' curr_status = utils.redis_get('camera_status') if curr_status: utils.redis_set('camera_status', False) time.sleep(1) pantilthat.pan(pan) pantilthat.tilt(tilt) if curr_status: utils.redis_set('camera_status', True) response = 'Successfully panned to {0} and tilted to {1}'.format(pan, tilt) return response
def notifications_on(): """Enable motion detected notifications Returns: str: Response to slack """ utils.redis_set('camera_notifications', True) return "Notications have been enable"
def notifications_off(): """Disable motion detected notifications Returns: str: Response to slack """ utils.redis_set('camera_notifications', False) return "Notications have been disabled"
def auto_detect_off(): """Turn off the who is home auto detection process. Returns: str: Response to slack """ utils.redis_set('auto_detect_status', False) return "Auto detect has been turned off"
def pycam_off(): """Turn off the pycam process. Returns: str: Response to slack """ utils.redis_set('camera_status', False) return "Pycam has been turned off"
def auto_detect_on(): """Turn on the who is home auto detection process. Returns: str: Response to slack """ if utils.redis_get('auto_detect_status'): response = 'Auto detect is already running' else: utils.redis_set('auto_detect_status', True) response = "Auto detect has been turned on" return response
def pycam_on(): """Turn on the pycam process. Returns: str: Response to slack """ if utils.redis_get('camera_status'): response = 'Pycam is already running' else: utils.redis_set('camera_status', True) response = "Pycam has been turned on" return response
def initialize(): """Initialize the security system app """ # set redis variables LOGGER.info('Initializing camera redis variables') pantilthat.pan(40) pantilthat.tilt(10) utils.redis_set('home', False) utils.redis_set('auto_detect_status', True) utils.redis_set('camera_status', True) utils.redis_set('camera_notifications', True) LOGGER.info('Initialization complete') return "Initialization completed"