Skip to content

Commit

Permalink
Don't try to relock the lock if it's locked when the auto-relock time…
Browse files Browse the repository at this point in the history
…r fires. (#24769)

Fixes #24766
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Oct 24, 2023
1 parent 07e9bc0 commit d7316e5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/app/clusters/door-lock-server/door-lock-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3801,8 +3801,19 @@ void MatterDoorLockClusterServerAttributeChangedCallback(const app::ConcreteAttr

void DoorLockServer::DoorLockOnAutoRelockCallback(chip::EndpointId endpointId)
{
emberAfDoorLockClusterPrintln("Door Auto relock timer expired. Locking...");
emberEventControlSetInactive(&DoorLockServer::Instance().AutolockEvent);
DoorLockServer::Instance().SetLockState(endpointId, DlLockState::kLocked, OperationSourceEnum::kAuto);
emberAfPluginDoorLockOnAutoRelock(endpointId);

Nullable<DlLockState> lockState;
if (Attributes::LockState::Get(endpointId, lockState) != EMBER_ZCL_STATUS_SUCCESS || lockState.IsNull() ||
lockState.Value() != DlLockState::kLocked)
{
emberAfDoorLockClusterPrintln("Door Auto relock timer expired. %s", "Locking...");

DoorLockServer::Instance().SetLockState(endpointId, DlLockState::kLocked, OperationSourceEnum::kAuto);
emberAfPluginDoorLockOnAutoRelock(endpointId);
}
else
{
emberAfDoorLockClusterPrintln("Door Auto relock timer expired. %s", "Already locked.");
}
}

0 comments on commit d7316e5

Please sign in to comment.