diff --git a/CHANGELOG.md b/CHANGELOG.md index fe44ff6..44fa2a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/custom_components/shinobi/api/shinobi_api.py b/custom_components/shinobi/api/shinobi_api.py index bcbcc15..207d9c0 100644 --- a/custom_components/shinobi/api/shinobi_api.py +++ b/custom_components/shinobi/api/shinobi_api.py @@ -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: diff --git a/custom_components/shinobi/manifest.json b/custom_components/shinobi/manifest.json index a6d438d..5819a64 100644 --- a/custom_components/shinobi/manifest.json +++ b/custom_components/shinobi/manifest.json @@ -10,6 +10,6 @@ "codeowners": ["@elad-bar"], "requirements": [ ], "config_flow": true, - "version": "1.1.11", + "version": "1.1.12", "iot_class": "local_polling" }