mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Handle key change in Yale Access Bluetooth after first connect (#88282)
This commit is contained in:
parent
4265def234
commit
714328d2ca
@ -28,5 +28,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/august",
|
||||
"iot_class": "cloud_push",
|
||||
"loggers": ["pubnub", "yalexs"],
|
||||
"requirements": ["yalexs==1.2.7", "yalexs_ble==2.0.0"]
|
||||
"requirements": ["yalexs==1.2.7", "yalexs_ble==2.0.1"]
|
||||
}
|
||||
|
@ -1,7 +1,15 @@
|
||||
"""The Yale Access Bluetooth integration."""
|
||||
from __future__ import annotations
|
||||
|
||||
from yalexs_ble import AuthError, PushLock, YaleXSBLEError, local_name_is_unique
|
||||
from yalexs_ble import (
|
||||
AuthError,
|
||||
ConnectionInfo,
|
||||
LockInfo,
|
||||
LockState,
|
||||
PushLock,
|
||||
YaleXSBLEError,
|
||||
local_name_is_unique,
|
||||
)
|
||||
|
||||
from homeassistant.components import bluetooth
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -76,6 +84,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
)
|
||||
)
|
||||
|
||||
@callback
|
||||
def _async_state_changed(
|
||||
new_state: LockState, lock_info: LockInfo, connection_info: ConnectionInfo
|
||||
) -> None:
|
||||
"""Handle state changed."""
|
||||
if new_state.auth and not new_state.auth.successful:
|
||||
entry.async_start_reauth(hass)
|
||||
|
||||
entry.async_on_unload(push_lock.register_callback(_async_state_changed))
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
entry.async_on_unload(entry.add_update_listener(_async_update_listener))
|
||||
return True
|
||||
|
@ -45,7 +45,7 @@ class YALEXSBLEEntity(Entity):
|
||||
self, new_state: LockState, lock_info: LockInfo, connection_info: ConnectionInfo
|
||||
) -> None:
|
||||
"""Update the state."""
|
||||
self._attr_available = True
|
||||
self._attr_available = bool(not new_state.auth or new_state.auth.successful)
|
||||
|
||||
@callback
|
||||
def _async_state_changed(
|
||||
|
@ -12,5 +12,5 @@
|
||||
"dependencies": ["bluetooth_adapters"],
|
||||
"documentation": "https://www.home-assistant.io/integrations/yalexs_ble",
|
||||
"iot_class": "local_push",
|
||||
"requirements": ["yalexs-ble==2.0.0"]
|
||||
"requirements": ["yalexs-ble==2.0.1"]
|
||||
}
|
||||
|
@ -2667,13 +2667,13 @@ xs1-api-client==3.0.0
|
||||
yalesmartalarmclient==0.3.9
|
||||
|
||||
# homeassistant.components.yalexs_ble
|
||||
yalexs-ble==2.0.0
|
||||
yalexs-ble==2.0.1
|
||||
|
||||
# homeassistant.components.august
|
||||
yalexs==1.2.7
|
||||
|
||||
# homeassistant.components.august
|
||||
yalexs_ble==2.0.0
|
||||
yalexs_ble==2.0.1
|
||||
|
||||
# homeassistant.components.yeelight
|
||||
yeelight==0.7.10
|
||||
|
@ -1889,13 +1889,13 @@ xmltodict==0.13.0
|
||||
yalesmartalarmclient==0.3.9
|
||||
|
||||
# homeassistant.components.yalexs_ble
|
||||
yalexs-ble==2.0.0
|
||||
yalexs-ble==2.0.1
|
||||
|
||||
# homeassistant.components.august
|
||||
yalexs==1.2.7
|
||||
|
||||
# homeassistant.components.august
|
||||
yalexs_ble==2.0.0
|
||||
yalexs_ble==2.0.1
|
||||
|
||||
# homeassistant.components.yeelight
|
||||
yeelight==0.7.10
|
||||
|
Loading…
x
Reference in New Issue
Block a user