You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
samples: matter: Introduce Timed Schedule Access in Lock
- Regenerated Matter Lock Zap to include Timed Schedule
Access feature
- Added Schedules for WeekDay, YearDay and Holiday
to the credentials manager according to Matter
Specification.
- Implemented callbacks for the schedule feature required
by door-lock-server.
- Moved credentials manager users, schedules and credentials
implementations to separate files due to a high number
of lines in the credentials_manager.cpp file.
- Added a guide to Matter Lock sample on how to use this
feature.
- Added guide how to enable the timed-access schedule feature
- Updated release notes.
- Changed names from credentials to access
Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
Copy file name to clipboardExpand all lines: samples/matter/lock/README.rst
+223-1Lines changed: 223 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ For details, see the `Commissioning the device`_ section.
76
76
Door lock credentials
77
77
=====================
78
78
79
-
By default, the application supports only PIN code credentials, but it is possible to implement support for other door lock credential types by using the ``CredentialsManager`` module.
79
+
By default, the application supports only PIN code credentials, but it is possible to implement support for other door lock credential types by using the ``AccessManager`` module.
80
80
The credentials can be used to control remote access to the bolt lock.
81
81
The PIN code assigned by the Matter controller is stored persistently, which means that it can survive a device reboot.
82
82
Depending on the IPv6 network technology in use, the following storage backends are supported by default to store the PIN code credential:
@@ -481,6 +481,115 @@ Upgrading the device firmware
481
481
482
482
To upgrade the device firmware, complete the steps listed for the selected method in the :doc:`matter:nrfconnect_examples_software_update` tutorial of the Matter documentation.
483
483
484
+
.. _matter_lock_scheduled_timed_access:
485
+
486
+
Scheduled timed access
487
+
======================
488
+
489
+
The scheduled timed access feature is an optional Matter lock feature that can be applicable to all available lock users.
490
+
You can use the scheduled timed access feature to allow guest users of the home to access the lock at the specific scheduled times.
491
+
To use this feature, you need to create at least one user on the lock device, and assign credentials.
492
+
For more information about setting user credentials, see the Saving users and credentials on door lock devices section of the :doc:`matter:chip_tool_guide` page in the :doc:`Matter documentation set <matter:index>`, and the :ref:`matter_lock_sample_remote_access_with_pin` section of this sample.
493
+
494
+
You can schedule the following types of timed access:
495
+
496
+
- ``Week-day`` - Restricts access to a specified time window on certain days of the week for a specific user.
497
+
This schedule grants repeated access each week.
498
+
When the schedule is cleared, the user is granted unrestricted access.
499
+
500
+
- ``Year-day`` - Restricts access to a specified time window on a specific date window.
501
+
This schedule grants access only once, and does not repeat.
502
+
When the schedule is cleared, the user is granted unrestricted access.
503
+
504
+
- ``Holiday`` - Sets up a holiday operating mode in the lock device.
505
+
You can choose one of the following operating modes:
506
+
507
+
- ``Normal`` - The lock operates normally.
508
+
- ``Vacation`` - Only remote operations are enabled.
509
+
- ``Privacy`` - All external interactions with the lock are disabled.
510
+
Can only be used if the lock is in the locked state.
511
+
Manually unlocking the lock changes the mode to ``Normal``.
512
+
- ``NoRemoteLockUnlock`` - All remote operations with the lock are disabled.
513
+
- ``Passage`` - The lock can be operated without providing a PIN.
514
+
This option can be used, for example, for employees during working hours.
515
+
516
+
To enable the scheduled timed access feature, complete the following steps:
517
+
518
+
1. Enable all needed scheduled timed access types in the ZAP file:
519
+
520
+
a. Open the :file:`lock.zap` file using the following west command:
521
+
522
+
.. code-block:: console
523
+
524
+
west zap-gui
525
+
526
+
#. Select the endpoint that contains the Matter Door Lock cluster.
527
+
By default, this is `Endpoint-1`.
528
+
529
+
#. Click the :guilabel:`Configure` symbol for the ``Door Lock`` cluster entry.
530
+
#. In the **Door Lock** context window, go to the **Attributes** tab and enable all required attributes:
531
+
532
+
* ``NumberOfWeekDaySchedulesSupportedPerUser`` for the ``Week-day`` schedule support.
533
+
* ``NumberOfYearDaySchedulesSupportedPerUser`` for the ``Year-day`` schedule support.
534
+
* ``NumberOfHolidaySchedulesSupported`` for the ``Holiday`` schedule support.
535
+
536
+
#. In the **Door Lock** context window, go to the **Attribute Reporting** page and enable all required attribute reporting entries:
537
+
538
+
* ``NumberOfWeekDaySchedulesSupportedPerUser`` for the ``Week-day`` schedule support.
539
+
* ``NumberOfYearDaySchedulesSupportedPerUser`` for the ``Year-day`` schedule support.
540
+
* ``NumberOfHolidaySchedulesSupported`` for the ``Holiday`` schedule support.
541
+
542
+
#. In the **Door Lock** context window, go to the **Commands** page and enable all required command entries:
543
+
544
+
* For the ``Week-day`` schedule support:
545
+
546
+
* ``SetWeekDaySchedule``
547
+
* ``GetWeekDaySchedule``
548
+
* ``GetWeekDayScheduleResponse``
549
+
* ``ClearWeekDaySchedule``
550
+
551
+
* For the ``Year-day`` schedule support:
552
+
553
+
* ``SetYearDaySchedule``
554
+
* ``GetYearDaySchedule``
555
+
* ``GetYearDayScheduleResponse``
556
+
* ``ClearYearDaySchedule``
557
+
558
+
* For the ``Holiday`` schedule support:
559
+
560
+
* ``SetHolidaySchedule``
561
+
* ``GetHolidaySchedule``
562
+
* ``GetHolidayScheduleResponse``
563
+
* ``ClearHolidaySchedule``
564
+
565
+
#. In the **Door Lock** context window, go to the **Attributes** tab and set the proper bits for the ``FeatureMap`` attribute:
566
+
567
+
* For the ``Week-day`` schedule support set the ``5th`` bit of the feature map bit map.
568
+
* For the ``Year-day`` schedule support set the ``11th`` bit of the feature map bit map.
569
+
* For the ``Holiday`` schedule support set the ``12th`` bit of the feature map bit map.
570
+
571
+
#. Save the :file:`lock.zap` file, and close ZAP-tool.
572
+
#. Generate new ZAP files with the changes in the Door Lock cluster using the following west command:
573
+
574
+
.. code-block:: console
575
+
576
+
west zap-generate
577
+
578
+
#. Enable the feature in the |NCS| Matter Lock sample by setting the :kconfig:option:`CONFIG_LOCK_SCHEDULES` Kconfig option to ``y``.
579
+
#. Use the following Kconfig options to modify the maximum number of specific schedule types:
580
+
581
+
- :kconfig:option:`CONFIG_LOCK_MAX_WEEKDAY_SCHEDULES_PER_USER` to define the maximum number of ``Week-day`` schedules for one user.
582
+
- :kconfig:option:`CONFIG_LOCK_MAX_YEARDAY_SCHEDULES_PER_USER` to define the maximum number of ``Year-day`` schedules for one user.
583
+
- :kconfig:option:`CONFIG_LOCK_MAX_HOLIDAY_SCHEDULES` to define the maximum number of ``Holiday`` schedules.
584
+
585
+
To learn more about configuring the Door Lock cluster, see the :ref:`ug_matter_creating_accessory` user guide.
586
+
587
+
All scheduled timed access entries are saved to non-volatile memory and loaded automatically after device reboot.
588
+
To disable the feature, you need to revert all changes in the :file:`lock.zap` file, re-generate the ZAP files and set the :kconfig:option:`CONFIG_LOCK_SCHEDULES` Kconfig option to ``n``.
589
+
590
+
.. note::
591
+
Adding a single schedule for a user contributes to the settings partition memory occupancy increase.
592
+
484
593
.. _matter_lock_sample_remote_access_with_pin:
485
594
486
595
Testing remote access with PIN code credential
@@ -536,6 +645,119 @@ After building the sample and programming it to your development kit, complete t
536
645
.. note::
537
646
Accessing the door lock remotely without a valid PIN code credential will fail.
538
647
648
+
.. _matter_lock_sample_schedule_testing:
649
+
650
+
Testing scheduled timed access
651
+
==============================
652
+
653
+
.. note::
654
+
You can test :ref:`matter_lock_scheduled_timed_access` using any Matter compatible controller.
655
+
The following steps use the CHIP Tool controller as an example.
656
+
657
+
After building the sample with the feature enabled and programming it to your development kit, complete the following steps to test scheduled timed access:
658
+
659
+
1. |connect_kit|
660
+
#. |connect_terminal_ANSI|
661
+
#. Wait until the device boots.
662
+
#. Commission an accessory with node ID equal to 10 to the Matter network by following the steps described in the `Commissioning the device`_ section.
* *weekday-index* is the index of the new schedule, starting from ``1``.
681
+
The maximum value is defined by the :kconfig:option:`CONFIG_LOCK_MAX_WEEKDAY_SCHEDULES_PER_USER` Kconfig option.
682
+
* *user-index* is the user index defined for the user created in the previous step.
683
+
* *days-mask* is a bitmap of numbers of the week days starting from ``0`` as a Sunday and finishing at ``6`` as a Saturday.
684
+
For example, to assign this schedule to Tuesday, Thursday and Saturday you need to provide ``84`` because it is equivalent to the ``01010100`` bitmap.
685
+
* *start-hour* is the starting hour for the week day schedule.
686
+
* *start-minute* is the starting minute for the week day schedule.
687
+
* *end-hour* is the ending hour for the week day schedule.
688
+
* *end-minute* is the ending hour for the week day schedule.
689
+
* *destination-id* is the device node ID.
690
+
* *endpoint-id* is the Matter door lock endpoint, in this sample assigned to ``1``.
691
+
692
+
For example, use the following command to set a ``Week-day`` schedule with index ``1`` for Tuesday, Thursday and Saturday to start at 7:30 AM and finish at 10:30 AM, dedicated for user with ID ``2``:
* *yearday-index* is the index of the new schedule, starting from ``1``.
708
+
The maximum value is defined by the :kconfig:option:`CONFIG_LOCK_MAX_YEARDAY_SCHEDULES_PER_USER` kconfig option.
709
+
* *user-index* is the user index defined for the user created in the previous step.
710
+
* *localtime-start* is the starting time in Epoch Time.
711
+
* *localtime-end* is the ending time in Epoch Time.
712
+
* *destination-id* is the device node ID.
713
+
* *endpoint-id* is the Matter door lock endpoint, in this sample assigned to ``1``.
714
+
715
+
Both ``localtime-start`` and ``localtime-end`` are in seconds with the local time offset based on the local timezone and DST offset on the day represented by the value.
716
+
717
+
For example, use the following command to set a ``Year-day`` schedule with index ``1`` to start on Monday, May 27, 2024, at 7:00:00 AM GMT+02:00 DST and finish on Thursday, May 30, 2024, at 7:00:00 AM GMT+02:00 DST dedicated for user with ID ``2``::
* *holiday-index* is the index of the new schedule, starting from ``1``.
731
+
* *localtime-start* is the starting time in Epoch Time.
732
+
* *localtime-end* is the ending time in Epoch Time.
733
+
* *operating-mode* is the operating mode described in the :ref:`matter_lock_scheduled_timed_access` section of this guide.
734
+
* *destination-id* is the device node ID.
735
+
* *endpoint-id* is the Matter door lock endpoint, in this sample assigned to ``1``.
736
+
737
+
For example, use the following command to setup a ``Holiday`` schedule with the operating mode ``Vacation`` to start on Monday, May 27, 2024, at 7:00:00 AM GMT+02:00 DST and finish on Thursday, May 30, 2024, at 7:00:00 AM GMT+02:00 DST:
0 commit comments