Skip to content

Commit

Permalink
hdd list fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-or committed Jun 30, 2023
1 parent 3fa5f88 commit a4c3880
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions custom_components/hikvision_next/isapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,18 +484,21 @@ async def get_storage_devices(self):

for storage in storage_info:
storage = storage.get("hdd")
if not isinstance(storage, list):
storage = [storage]
if storage:
storage_list.append(
HDDInfo(
id=int(storage.get("id")),
name=storage.get("hddName"),
type=storage.get("hddType"),
status=storage.get("status"),
capacity=int(storage.get("capacity")),
freespace=int(storage.get("freeSpace")),
property=storage.get("property"),
for hdd in storage:
storage_list.append(
HDDInfo(
id=int(hdd.get("id")),
name=hdd.get("hddName"),
type=hdd.get("hddType"),
status=hdd.get("status"),
capacity=int(hdd.get("capacity")),
freespace=int(hdd.get("freeSpace")),
property=hdd.get("property"),
)
)
)

return storage_list

Expand Down

0 comments on commit a4c3880

Please sign in to comment.