Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix august lock/unlock with older bridges #64143

Merged
merged 1 commit into from Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions homeassistant/components/august/__init__.py
Expand Up @@ -261,13 +261,14 @@ async def async_status_async(self, device_id):
device_id,
)

async def async_lock_async(self, device_id):
async def async_lock_async(self, device_id, hyper_bridge):
"""Lock the device but do not wait for a response since it will come via pubnub."""
return await self._async_call_api_op_requires_bridge(
device_id,
self._api.async_lock_async,
self._august_gateway.access_token,
device_id,
hyper_bridge,
)

async def async_unlock(self, device_id):
Expand All @@ -279,13 +280,14 @@ async def async_unlock(self, device_id):
device_id,
)

async def async_unlock_async(self, device_id):
async def async_unlock_async(self, device_id, hyper_bridge):
"""Unlock the device but do not wait for a response since it will come via pubnub."""
return await self._async_call_api_op_requires_bridge(
device_id,
self._api.async_unlock_async,
self._august_gateway.access_token,
device_id,
hyper_bridge,
)

async def _async_call_api_op_requires_bridge(
Expand Down
9 changes: 7 additions & 2 deletions homeassistant/components/august/lock.py
Expand Up @@ -46,17 +46,22 @@ def __init__(self, data, device):
self._attr_unique_id = f"{self._device_id:s}_lock"
self._update_from_data()

@property
def _hyper_bridge(self):
"""Check if the lock has a paired hyper bridge."""
return bool(self._detail.bridge and self._detail.bridge.hyper_bridge)

async def async_lock(self, **kwargs):
"""Lock the device."""
if self._data.activity_stream.pubnub.connected:
await self._data.async_lock_async(self._device_id)
await self._data.async_lock_async(self._device_id, self._hyper_bridge)
return
await self._call_lock_operation(self._data.async_lock)

async def async_unlock(self, **kwargs):
"""Unlock the device."""
if self._data.activity_stream.pubnub.connected:
await self._data.async_unlock_async(self._device_id)
await self._data.async_unlock_async(self._device_id, self._hyper_bridge)
return
await self._call_lock_operation(self._data.async_unlock)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/august/manifest.json
Expand Up @@ -2,7 +2,7 @@
"domain": "august",
"name": "August",
"documentation": "https://www.home-assistant.io/integrations/august",
"requirements": ["yalexs==1.1.18"],
"requirements": ["yalexs==1.1.19"],
"codeowners": ["@bdraco"],
"dhcp": [
{
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Expand Up @@ -2503,7 +2503,7 @@ xs1-api-client==3.0.0
yalesmartalarmclient==0.3.7

# homeassistant.components.august
yalexs==1.1.18
yalexs==1.1.19

# homeassistant.components.yeelight
yeelight==0.7.8
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Expand Up @@ -1525,7 +1525,7 @@ xmltodict==0.12.0
yalesmartalarmclient==0.3.7

# homeassistant.components.august
yalexs==1.1.18
yalexs==1.1.19

# homeassistant.components.yeelight
yeelight==0.7.8
Expand Down