Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #278 from bdraco/optional_width_height
Browse files Browse the repository at this point in the history
Allow requesting a custom snapshot width and height
  • Loading branch information
briis committed Aug 11, 2021
2 parents 442c766 + 39dd898 commit 6cccb66
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions custom_components/unifiprotect/camera.py
@@ -1,6 +1,7 @@
"""Support for Ubiquiti's Unifi Protect NVR."""
import logging
import os
from typing import Optional

from homeassistant.components.camera import SUPPORT_STREAM, Camera
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -316,14 +317,18 @@ async def async_disable_motion_detection(self):
return
_LOGGER.debug("Motion Detection Disabled for Camera: %s", self._name)

async def async_camera_image(self):
async def async_camera_image(
self, width: Optional[int] = None, height: Optional[int] = None
):
"""Return the Camera Image."""
if self._snapshot_direct:
last_image = await self.upv_object.get_snapshot_image_direct(
self._device_id
)
else:
last_image = await self.upv_object.get_snapshot_image(self._device_id)
last_image = await self.upv_object.get_snapshot_image(
self._device_id, width, height
)
self._last_image = last_image
return self._last_image

Expand Down

0 comments on commit 6cccb66

Please sign in to comment.