Fix response value check

These commands were not implemented like this before. At least on the
camera i used for testing (RLC-411) the return value was always a list
and the status code is an int.
This commit is contained in:
Max Ziermann
2020-03-06 20:18:08 +01:00
parent b3e6b80cac
commit 8693daa6ea
3 changed files with 10 additions and 10 deletions

View File

@@ -16,8 +16,8 @@ class DeviceAPIMixin:
:return: bool
"""
body = [{"cmd": "Format", "action": 0, "param": {"HddInfo": {"id": hdd_id}}}]
r_data = self._execute_command('Format', body)
if r_data["value"]["rspCode"] == "200":
r_data = self._execute_command('Format', body)[0]
if r_data["value"]["rspCode"] == 200:
return True
print("Could not format HDD/SD. Camera responded with:", r_data["value"])
return False