Bump yalexs to 6.3.0 to move camera logic to the lib (#119941)

This commit is contained in:
J. Nick Koston 2024-06-18 18:52:41 -05:00 committed by GitHub
parent 8f3dcd6557
commit 60e64d14af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 33 deletions

View File

@ -6,8 +6,7 @@ import logging
from aiohttp import ClientSession
from yalexs.activity import ActivityType
from yalexs.const import Brand
from yalexs.doorbell import ContentTokenExpired, Doorbell
from yalexs.doorbell import Doorbell
from yalexs.util import update_doorbell_image_from_activity
from homeassistant.components.camera import Camera
@ -46,7 +45,6 @@ class AugustCamera(AugustEntityMixin, Camera):
_attr_motion_detection_enabled = True
_attr_brand = DEFAULT_NAME
_image_url: str | None = None
_content_token: str | None = None
_image_content: bytes | None = None
def __init__(
@ -91,24 +89,9 @@ class AugustCamera(AugustEntityMixin, Camera):
self._update_from_data()
if self._image_url is not self._detail.image_url:
self._image_url = self._detail.image_url
self._content_token = self._detail.content_token or self._content_token
_LOGGER.debug(
"calling doorbell async_get_doorbell_image, %s",
self._detail.device_name,
self._image_content = await self._data.async_get_doorbell_image(
self._device_id, self._session, timeout=self._timeout
)
try:
self._image_content = await self._detail.async_get_doorbell_image(
self._session, timeout=self._timeout
)
except ContentTokenExpired:
if self._data.brand == Brand.YALE_HOME:
_LOGGER.debug(
"Error fetching camera image, updating content-token from api to retry"
)
await self._async_update()
self._image_content = await self._detail.async_get_doorbell_image(
self._session, timeout=self._timeout
)
self._image_url = self._detail.image_url
return self._image_content

View File

@ -2,9 +2,7 @@
from __future__ import annotations
from yalexs.const import DEFAULT_BRAND
from yalexs.lock import LockDetail
from yalexs.manager.const import CONF_BRAND
from yalexs.manager.data import YaleXSData
from yalexs_ble import YaleXSBLEDiscovery
@ -51,14 +49,8 @@ class AugustData(YaleXSData):
) -> None:
"""Init August data object."""
self._hass = hass
self._config_entry = config_entry
super().__init__(august_gateway, HomeAssistantError)
@property
def brand(self) -> str:
"""Brand of the device."""
return self._config_entry.data.get(CONF_BRAND, DEFAULT_BRAND)
@callback
def async_offline_key_discovered(self, detail: LockDetail) -> None:
"""Handle offline key discovery."""

View File

@ -28,5 +28,5 @@
"documentation": "https://www.home-assistant.io/integrations/august",
"iot_class": "cloud_push",
"loggers": ["pubnub", "yalexs"],
"requirements": ["yalexs==6.1.0", "yalexs-ble==2.4.2"]
"requirements": ["yalexs==6.3.0", "yalexs-ble==2.4.2"]
}

View File

@ -2939,7 +2939,7 @@ yalesmartalarmclient==0.3.9
yalexs-ble==2.4.2
# homeassistant.components.august
yalexs==6.1.0
yalexs==6.3.0
# homeassistant.components.yeelight
yeelight==0.7.14

View File

@ -2295,7 +2295,7 @@ yalesmartalarmclient==0.3.9
yalexs-ble==2.4.2
# homeassistant.components.august
yalexs==6.1.0
yalexs==6.3.0
# homeassistant.components.yeelight
yeelight==0.7.14

View File

@ -213,7 +213,7 @@ async def _create_august_api_with_devices(
async def _mock_setup_august_with_api_side_effects(
hass, api_call_side_effects, pubnub, brand=Brand.AUGUST
):
api_instance = MagicMock(name="Api")
api_instance = MagicMock(name="Api", brand=brand)
if api_call_side_effects["get_lock_detail"]:
type(api_instance).async_get_lock_detail = AsyncMock(