Skip to content

Commit

Permalink
Fixed #16 - Added support for single camera
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Sep 15, 2021
1 parent e35c4a8 commit 8a701c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.1.12

- Added support for single camera (response of an object instead of array) [#16](https://github.com/elad-bar/ha-shinobi/issues/16)

## 1.1.11

- Added more logs for debugging invalid monitor's loading
Expand Down
13 changes: 11 additions & 2 deletions custom_components/shinobi/api/shinobi_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,18 @@ async def load_camera(self):
_LOGGER.debug("Retrieving camera list")

camera_list = []
monitors = await self.async_get(URL_MONITORS)
response = await self.async_get(URL_MONITORS)

if response is None:
_LOGGER.warning("No monitors were found")

else:
if isinstance(response, list):
monitors = response

else:
monitors: List = [response]

if monitors is not None:
for monitor in monitors:
try:
if monitor is None:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/shinobi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"codeowners": ["@elad-bar"],
"requirements": [ ],
"config_flow": true,
"version": "1.1.11",
"version": "1.1.12",
"iot_class": "local_polling"
}

0 comments on commit 8a701c6

Please sign in to comment.