diff --git a/homeassistant/components/amcrest/__init__.py b/homeassistant/components/amcrest/__init__.py index 166d2e74ffd..f2472575259 100644 --- a/homeassistant/components/amcrest/__init__.py +++ b/homeassistant/components/amcrest/__init__.py @@ -52,6 +52,7 @@ from .const import ( DATA_AMCREST, DEVICES, DOMAIN, + RESOLUTION_LIST, SERVICE_EVENT, SERVICE_UPDATE, ) @@ -76,8 +77,6 @@ RECHECK_INTERVAL = timedelta(minutes=1) NOTIFICATION_ID = "amcrest_notification" NOTIFICATION_TITLE = "Amcrest Camera Setup" -RESOLUTION_LIST = {"high": 0, "low": 1} - SCAN_INTERVAL = timedelta(seconds=10) AUTHENTICATION_LIST = {"basic": "basic"} diff --git a/homeassistant/components/amcrest/camera.py b/homeassistant/components/amcrest/camera.py index 49d5cfd7afd..61b97b041cd 100644 --- a/homeassistant/components/amcrest/camera.py +++ b/homeassistant/components/amcrest/camera.py @@ -35,6 +35,7 @@ from .const import ( DATA_AMCREST, DEVICES, DOMAIN, + RESOLUTION_TO_STREAM, SERVICE_UPDATE, SNAPSHOT_TIMEOUT, ) @@ -533,13 +534,14 @@ class AmcrestCam(Camera): return async def _async_get_video(self) -> bool: - stream = {0: "Main", 1: "Extra"} return await self._api.async_is_video_enabled( - channel=0, stream=stream[self._resolution] + channel=0, stream=RESOLUTION_TO_STREAM[self._resolution] ) async def _async_set_video(self, enable: bool) -> None: - await self._api.async_set_video_enabled(enable, channel=0) + await self._api.async_set_video_enabled( + enable, channel=0, stream=RESOLUTION_TO_STREAM[self._resolution] + ) async def _async_enable_video(self, enable: bool) -> None: """Enable or disable camera video stream.""" @@ -585,10 +587,14 @@ class AmcrestCam(Camera): ) async def _async_get_audio(self) -> bool: - return await self._api.async_audio_enabled + return await self._api.async_is_audio_enabled( + channel=0, stream=RESOLUTION_TO_STREAM[self._resolution] + ) async def _async_set_audio(self, enable: bool) -> None: - await self._api.async_set_audio_enabled(enable) + await self._api.async_set_audio_enabled( + enable, channel=0, stream=RESOLUTION_TO_STREAM[self._resolution] + ) async def _async_enable_audio(self, enable: bool) -> None: """Enable or disable audio stream.""" diff --git a/homeassistant/components/amcrest/const.py b/homeassistant/components/amcrest/const.py index 89cde63a08a..6c2fe431d43 100644 --- a/homeassistant/components/amcrest/const.py +++ b/homeassistant/components/amcrest/const.py @@ -13,3 +13,6 @@ SNAPSHOT_TIMEOUT = 20 SERVICE_EVENT = "event" SERVICE_UPDATE = "update" + +RESOLUTION_LIST = {"high": 0, "low": 1} +RESOLUTION_TO_STREAM = {0: "Main", 1: "Extra"} diff --git a/homeassistant/components/amcrest/manifest.json b/homeassistant/components/amcrest/manifest.json index 5a7bec89e31..b4646be5e66 100644 --- a/homeassistant/components/amcrest/manifest.json +++ b/homeassistant/components/amcrest/manifest.json @@ -2,7 +2,7 @@ "domain": "amcrest", "name": "Amcrest", "documentation": "https://www.home-assistant.io/integrations/amcrest", - "requirements": ["amcrest==1.9.4"], + "requirements": ["amcrest==1.9.7"], "dependencies": ["ffmpeg"], "codeowners": ["@flacjacket"], "iot_class": "local_polling", diff --git a/requirements_all.txt b/requirements_all.txt index 503be5656cb..22d58dc484f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -311,7 +311,7 @@ amberelectric==1.0.3 ambiclimate==0.2.1 # homeassistant.components.amcrest -amcrest==1.9.4 +amcrest==1.9.7 # homeassistant.components.androidtv androidtv[async]==0.0.63