def analyze_status(self, status: Status) -> [Event]: if "motion" not in status.keys(): if "picture" in status.keys(): picture = status["picture"] if self._detect_motion(picture): status["motion"] = True else: status["motion"] = False else: return [] if status["motion"]: return [Event.motionDetected] else: return []
def _prepare_json_status(status: Status) -> JSON: json_status = dict() for item in status.items(): key, value = item if key == "timestamp": value = str(value) elif key == "picture": value = _get_file_name(status["timestamp"]) json_status[key] = value return json_status