|
|
@@ -198,9 +198,13 @@ def register_services(hass: HomeAssistant) -> None:
|
|
|
source_node = async_get_node_from_entity_id(hass, source_lock_entity_id)
|
|
|
target_node = async_get_node_from_entity_id(hass, target_lock_entity_id)
|
|
|
|
|
|
- source_users = [u for u in await source_node.access_control.get_users() if u.user_id != 0]
|
|
|
+ # Cached, not fresh: on some devices a live get_users() only enumerates a
|
|
|
+ # "normal" slot range and drops out-of-range entries (e.g. a slot number
|
|
|
+ # reused as a backup/admin code), while get_users_cached() — the same
|
|
|
+ # call the slots sensor uses — reports them correctly.
|
|
|
+ source_users = [u for u in await source_node.access_control.get_users_cached() if u.user_id != 0]
|
|
|
target_slot_ids = {
|
|
|
- u.user_id for u in await target_node.access_control.get_users() if u.user_id != 0
|
|
|
+ u.user_id for u in await target_node.access_control.get_users_cached() if u.user_id != 0
|
|
|
}
|
|
|
|
|
|
_LOGGER.info(
|
|
|
@@ -229,7 +233,7 @@ def register_services(hass: HomeAssistant) -> None:
|
|
|
credential_rule=user.credential_rule,
|
|
|
expiring_timeout_minutes=user.expiring_timeout_minutes,
|
|
|
)
|
|
|
- credentials = await source_node.access_control.get_credentials(slot)
|
|
|
+ credentials = await source_node.access_control.get_credentials_cached(slot)
|
|
|
pin = next((c.data for c in credentials if c.type == UserCredentialType.PIN_CODE), None)
|
|
|
credential = (
|
|
|
AddUserCredential(credential_type=UserCredentialType.PIN_CODE, credential_slot=slot, data=pin)
|