From d1973093490a3ae498b00cd0ae592188151ec42b Mon Sep 17 00:00:00 2001 From: mrlt8 <67088095+mrlt8@users.noreply.github.com> Date: Sat, 6 Jul 2024 21:41:13 -0700 Subject: [PATCH] Get device_setting from cloud #1194 --- app/wyzebridge/wyze_api.py | 5 ++++- app/wyzebridge/wyze_stream.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/wyzebridge/wyze_api.py b/app/wyzebridge/wyze_api.py index 77213545..a429b8cc 100644 --- a/app/wyzebridge/wyze_api.py +++ b/app/wyzebridge/wyze_api.py @@ -331,7 +331,7 @@ def run_action(self, cam: WyzeCamera, action: str): return {"status": "error", "response": str(ex)} @authenticated - def get_device_info(self, cam: WyzeCamera, pid: str = ""): + def get_device_info(self, cam: WyzeCamera, pid: str = "", cmd: str = ""): logger.info(f"[CONTROL] ☁️ get_device_Info for {cam.name_uri} via Wyze API") params = {"device_mac": cam.mac, "device_model": cam.product_model} try: @@ -341,6 +341,9 @@ def get_device_info(self, cam: WyzeCamera, pid: str = ""): logger.error(f"[CONTROL] ERROR: {ex}") return {"status": "error", "response": str(ex)} + if cmd in resp: + return {"status": "success", "response": resp[cmd]} + if not pid: return {"status": "success", "response": property_list} diff --git a/app/wyzebridge/wyze_stream.py b/app/wyzebridge/wyze_stream.py index 2fcc6b1c..a1e6d20e 100644 --- a/app/wyzebridge/wyze_stream.py +++ b/app/wyzebridge/wyze_stream.py @@ -338,6 +338,8 @@ def send_cmd(self, cmd: str, payload: str | list | dict = "") -> dict: if cmd == "device_info": return self.api.get_device_info(self.camera) + if cmd == "device_setting": + return self.api.get_device_info(self.camera, cmd="device_setting") if cmd == "battery": return self.api.get_device_info(self.camera, "P8")