espressif / esp-matter

Espressif's SDK for Matter
Apache License 2.0
662 stars 155 forks source link

Matter Door lock with HomeKey (CON-1227) #986

Closed bilalmalik76 closed 2 months ago

bilalmalik76 commented 3 months ago

We have developed a Matter door lock with ESP32 and now we want to add support of Homekey by using an iPhone to tap to unlock the door with a home key, something similar to this one? https://smartapfel.com/matter-door-locks-can-be-unlocked-via-apple-home-key/

Can you please guide how can we achieve this? or if this support is by default available in matter enabled door lock?

VaishaliAvhale commented 3 months ago

Hi @bilalmalik76, Please add the following header file and the door lock and unlock functions to lock and unlock the door.

#include <app/clusters/door-lock-server/door-lock-server.h>

bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const chip::app::DataModel::Nullable<chip::FabricIndex> & fabricIdx,
                                            const chip::app::DataModel::Nullable<chip::NodeId> & nodeId, const chip::Optional<chip::ByteSpan> & pinCode,
                                            chip::app::Clusters::DoorLock::OperationErrorEnum & err)
{
    ChipLogProgress(Zcl, "Door Lock App: Lock Command endpoint=%d", endpointId);
    DoorLockServer::Instance().SetLockState(endpointId, chip::app::Clusters::DoorLock::DlLockState::kLocked);
    return true;
}

bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const chip::app::DataModel::Nullable<chip::FabricIndex> & fabricIdx,
                                            const chip::app::DataModel::Nullable<chip::NodeId> & nodeId, const chip::Optional<chip::ByteSpan> & pinCode,
                                            chip::app::Clusters::DoorLock::OperationErrorEnum & err)
{
    ChipLogProgress(Zcl, "Door Lock App: unlock Command endpoint=%d", endpointId);
    DoorLockServer::Instance().SetLockState(endpointId, chip::app::Clusters::DoorLock::DlLockState::kUnlocked);
    return true;
}
bilalmalik76 commented 2 months ago

@VaishaliAvhale No this is not my original question, we have implemented all matter door lock functionality and it is working fine. Now we want to add support of Homekey by using an iPhone to tap to unlock the door with a home key, something similar to this one? https://smartapfel.com/matter-door-locks-can-be-unlocked-via-apple-home-key/

VaishaliAvhale commented 2 months ago

Sorry, it's my bad. I will check and get back to you.

dhrishi commented 2 months ago

I think this is more of a question to the Apple team