Matter Door Lock Application

The Matter Door Lock Application demonstrates the usage of the Matter application layer to build a door lock device with one basic bolt. You can use it as a reference for creating your application.

This device works as a Matter accessory device, meaning it can be paired and controlled remotely over a Matter network built on top of a low-power 802.15.4 (Thread) protocol. This device works as a Thread Sleepy End Device. See the Adding clusters to Matter application page for an overview of the process you need to follow.

Note

From the nRF Connect SDK v3.4.0 release, the Matter lock sample is no longer part of the nRF Connect SDK repository. Instead, it is now part of the nRF Door Lock and Access Control Add-on. If you are migrating from nRF Connect SDK v3.3.0 or earlier, bump the version in the applications/matter-door-lock-app/VERSION file. Set it above the version currently running on the device before building a firmware update for an already-deployed door lock.

Requirements

The application supports the following development kits:

Supported hardware platforms

Hardware platforms

PCA

Board name

Board target

nRF54LM20 DK

PCA10184

nrf54lm20dk

nrf54lm20dk/nrf54lm20b/cpuapp
nrf54lm20dk/nrf54lm20a/cpuapp

nRF54L15 DK

PCA10156

nrf54l15dk

nrf54l15dk/nrf54l15/cpuapp

nRF5340 DK

PCA10095

nrf5340dk

nrf5340dk/nrf5340/cpuapp

nRF52840 DK

PCA10056

nrf52840dk

nrf52840dk/nrf52840

If you want to commission the Door Lock device and control it remotely through a Thread network, you need to set up the Thread Border Router and control it with the chip-tool, or use a commercial ecosystem controller. When this happens, you will also be able to control it through a Matter controller device configured on PC or smartphone. This requires additional hardware depending on the setup you choose.

Note

Matter requires the GN tool. If you are updating from the nRF Connect SDK version earlier than v1.5.0, see the GN installation instructions.

IPv6 network support

Matter over Thread (IPv6 network) is supported for the nrf52840dk/nrf52840, nrf5340dk/nrf5340/cpuapp, nrf54l15dk/nrf54l15/cpuapp, nrf54lm20dk/nrf54lm20b/cpuapp, and nrf54lm20dk/nrf54lm20a/cpuapp board targets.

Overview

The application uses buttons for changing the lock and device states, and LEDs to show the state of these changes. You can test it in the following ways:

  • Standalone, using a single DK that runs the Door Lock application.

  • Remotely over the Thread protocol, which in either case requires more devices, including a Matter controller that you can configure either on a PC or a mobile device.

Matter Door Lock Application features

The Door Lock application implements the following features:

  • Door Lock credentials - Support for Door Lock credentials and users.

  • Matter Bluetooth LE with Nordic UART Service - Support for Matter Bluetooth LE with Nordic UART Service.

  • Scheduled timed access - Support for scheduled timed access.

Door Lock application credentials

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 MatterAccess module. The credentials can be used to control remote access to the bolt lock. The PIN code assigned by the Matter controller is stored persistently, which means that it can survive a device reboot. The secure storage implementation is enabled by default (CONFIG_DOOR_LOCK_MATTER_ACCESS_STORAGE_PROTECTED_STORAGE) to store credentials and other application’s configuration data.

The application supports multiple Door Lock users and PIN code credentials. The following Kconfig options control the limits of the users and credentials that can be added to the Door Lock:

  • CONFIG_DOOR_LOCK_MATTER_ACCESS_MAX_NUM_USERS - Maximum number of users supported by the Door Lock.

  • CONFIG_DOOR_LOCK_MATTER_ACCESS_MAX_NUM_CREDENTIALS_PER_USER - Maximum number of credentials that can be assigned to one user.

  • CONFIG_DOOR_LOCK_MATTER_ACCESS_MAX_NUM_CREDENTIALS_PER_TYPE - Maximum number of credentials in total.

  • CONFIG_DOOR_LOCK_MATTER_ACCESS_MAX_CREDENTIAL_LENGTH - Maximum length of a single credential in bytes.

Matter Bluetooth LE with Nordic UART Service

The nRF Door Lock and Access Control Add-on lets you extend the Door Lock with an additional Bluetooth LE service (Nordic UART Service (NUS)) and use it, even when the device is not connected to a Matter network. See NUS service for the reusable NUS wrapper, Kconfig options, and the bt_nus snippet. Using NUS, you can declare commands specific to a application and use them to control the device remotely through Bluetooth LE. The connection between the device and the Bluetooth controller is secured and requires providing a passcode to pair the devices.

In the Matter Door Lock Application, you can use the following commands with the Bluetooth LE with NUS:

  • Lock - To lock the door of the connected device.

  • Unlock - To unlock the door of the connected device.

If the device is already connected to the Matter network, the notification about changing the lock state will be sent to the Bluetooth controller.

Scheduled timed access

The scheduled timed access feature is an optional application feature that can be applicable to all available lock users. You can use the scheduled timed access feature to allow guest users of the home to access the lock at the specific scheduled times. To use this feature, you need to create at least one user on the application device, and assign credentials to that user. For more information about setting user credentials, see the Saving users and credentials on Door Lock devices section of the Matter chip-tool guide in the Matter documentation set, and the Testing Door Lock Application features section. You can schedule the following types of timed access:

  • Week-day - Restricts access to a specified time window on certain days of the week for a specific user. This schedule grants repeated access each week. When the schedule is cleared, the user is granted unrestricted access.

  • Year-day - Restricts access to a specified time window on a specific date window. This schedule grants access only once, and does not repeat. When the schedule is cleared, the user is granted unrestricted access.

  • Holiday - Sets up a holiday operating mode in the lock device. You can choose one of the following operating modes:

    • Normal - The lock operates normally.

    • Vacation - Only remote operations are enabled.

    • Privacy - All external interactions with the lock are disabled. Can only be used if the lock is in the locked state. Manually unlocking the lock changes the mode to Normal.

    • NoRemoteLockUnlock - All remote operations with the lock are disabled.

    • Passage - The lock can be operated without providing a PIN. This option can be used, for example, for employees during working hours.

To use the scheduled timed access feature, enable the Schedules support.

See the Testing Door Lock Application features section of this application for more information about testing the scheduled timed access feature.

Configuration

This section describes the configuration options for the application.

See Configuring and building for information about how to permanently or temporarily change the configuration.

The application uses a prj.conf configuration file located in the sample root directory for the default configuration. It also provides additional files for different custom configurations. When you build the sample, you can select one of these configurations using the FILE_SUFFIX variable.

See Custom configurations and Providing CMake options for more information.

Note

If you are working with multiple devices, set a unique discriminator for each one, or commission them one at a time. See Matter device identification page for more information.

The application supports the following build configurations:

Door Lock build configurations

Configuration

File name

FILE_SUFFIX

Supported board

Description

Debug (default)

prj.conf

No suffix

All from Requirements

Debug version of the application.

Enables additional features for verifying the application behavior, such as logs.

Release

prj_release.conf

release

All from Requirements

Release version of the application.

Enables only the necessary application functionalities to optimize its performance.

Advanced configuration options

This section describes advanced configuration options that you can apply in this application. Use the click to show toggle to expand the content.

Device firmware upgrade support

The application supports device firmware upgrade (DFU) over-the-air (OTA) using the following protocols:

  • Matter OTA update protocol that uses the Matter operational network for querying and downloading a new firmware image.

  • Simple Management Protocol (SMP) over Bluetooth LE. In this case, the DFU can be done either using a smartphone application or a PC command-line tool. This protocol is not part of the Matter specification.

In both cases, the MCUboot secure bootloader is used to apply the new firmware image.

The DFU over Matter is enabled by default. Additionally, you can enable the DFU over SMP by building with the dfu_smp snippet (for example, add -Dmatter-door-lock-app_SNIPPET=dfu_smp to your CMake arguments). See Device Firmware Update over SMP and DFU SMP service for transport details, shell commands, and Kconfig options.

See CMake options for instructions on how to add these options to your build.

SMP advertising is not started automatically after boot. Press Button 3 to toggle it, or use the dfu_smp on / dfu_smp off shell commands when shell support is enabled.

The following platforms require external flash memory to perform the DFU:

  • nRF52840 DK

  • nRF5340 DK

  • nRF54L15 DK

You can run DFU without external flash memory on the nRF54LM20 DK using the MCUboot image compression feature.

When building with nRF Connect for VS Code extension, add -Dmatter-door-lock-app_SNIPPET=dfu_smp to Extra CMake arguments to enable DFU over SMP.

Factory data support

In this application, factory data support specific to the nRF Connect SDK is enabled by default for all configurations. This means that a new factory data set will be automatically generated when building for the target board.

To disable factory data support, set the following Kconfig options to n:

  • CONFIG_CHIP_FACTORY_DATA

  • SB_CONFIG_MATTER_ADD_ON_FACTORY_DATA_GENERATE

To learn more about factory data, read the Factory provisioning user guide.

Custom board with Nordic SoC

To prepare the application to work with a custom board, complete the following steps:

  1. Refer to the Create your board directory Zephyr guide and complete the instructions.

  2. Modify the contents of the board.yaml file according to the Write your board YAML user guide.

  3. Update the Write your devicetree (all .dts and .dtsi files) to match your board’s requirements.

  4. Write Kconfig files to enable all required Kconfig options for your board.

  5. If your device uses external flash, add its devicetree definition under the board/<board_name>_<soc_name>.overlay file, and set nordic,pm-ext-flash in the devicetree’s chosen configuration.

  6. Refer to the Advanced Matter Kconfig options user guide, create your list of advanced configurations for your board, and apply the selected Kconfig options in the prj.conf file.

  7. See the List of threads used in Matter application and adjust stack sizes according to your board and project requirements.

  8. A custom board does not have support for LEDs and buttons by default. Therefore, you need to provide your own implementation of the ncs-matter/subsys/board/board.cpp board file.

For more information, see the following guides:

Internal memory only

For the nRF54LM20 DK, you can configure the application to use only the internal RRAM for storage. It applies to the DFU as well, which means that both the currently running firmware and the new firmware to be updated will be stored within the device’s internal RRAM memory.

The DFU image fits in the internal flash memory if you use MCUboot image compression.

This configuration is disabled by default for the Matter Door Lock application. To enable it, set the FILE_SUFFIX CMake option to internal.

To build the application for the nRF54LM20 DK with support for Matter OTA DFU and DFU over Bluetooth SMP, and using internal RRAM only:

Add -Dmatter-door-lock-app_SNIPPET=dfu_smp -DFILE_SUFFIX=internal to Extra CMake arguments in your build configuration.

To build the application for the same purpose in the release configuration:

Add -Dmatter-door-lock-app_SNIPPET=dfu_smp -DFILE_SUFFIX=internal -Dmatter-door-lock-app_EXTRA_CONF_FILE=prj_release.conf to Extra CMake arguments in your build configuration.

west build -p -b nrf54lm20dk/nrf54lm20b/cpuapp -- -Dmatter-door-lock-app_SNIPPET=dfu_smp -DFILE_SUFFIX=internal -Dmatter-door-lock-app_EXTRA_CONF_FILE=prj_release.conf

In this case, the size of the MCUboot secondary partition used for storing the new application image is approximately 30-40% smaller than it would be when using a configuration with external flash memory support.

Enabling Matter Bluetooth LE with Nordic UART Service

To enable the Nordic UART Service (NUS) feature, build with the bt_nus snippet (for example, add -Dmatter-door-lock-app_SNIPPET=bt_nus to your CMake arguments). See NUS service for Kconfig options and usage.

Note

This application supports one Bluetooth LE connection at a time. Matter commissioning, DFU, and NUS over Bluetooth LE must be run separately.

The Door Lock’s Bluetooth LE service extension with NUS requires a secure connection with a smartphone, which is established using a security PIN code. The pairing passkey is controlled by the CONFIG_DOOR_LOCK_BLE_MANAGER_AUTH_APP_PASSKEY Kconfig option. Its default is 123456 unless you override it at build time (for example, -DCONFIG_DOOR_LOCK_BLE_MANAGER_AUTH_APP_PASSKEY=112233). During the pairing procedure, the device will print the passkey to the log console in the following way:

PROVIDE THE FOLLOWING CODE IN YOUR MOBILE APP: 123456

See the Testing Door Lock Application features section for more information about how to test this feature.

Scheduled timed access

To enable the scheduled timed access feature:

Add -DEXTRA_CONF_FILE=schedules.conf to Extra CMake arguments in your build configuration.

User interface

This section describes the user interface available on the development kit in this application.

Development kit interface

This application implements the following interface available on a development kit.

LED 1:

Shows the overall state of the device and its connectivity. The following states are possible:

  • Short Flash On (50 ms on/950 ms off) - The device is in the unprovisioned (unpaired) state and is waiting for a commissioning application to connect.

  • Rapid Even Flashing (100 ms on/100 ms off) - The device is in the unprovisioned state and a commissioning application is connected over Bluetooth LE.

  • Solid On - The device is fully provisioned.

LED 2:

Shows the state of the lock. The following states are possible:

  • Solid On - The bolt is extended and the door is locked.

  • Off - The bolt is retracted and the door is unlocked.

  • Rapid Even Flashing (50 ms on/50 ms off during 2 s) - The simulated bolt is in motion from one position to another.

    Additionally, the LED starts blinking evenly (500 ms on/500 ms off) when the Identify command of the Identify cluster is received on the endpoint 1. The command’s argument can be used to specify the duration of the effect.

Button 1:

Depending on how long you press the button:

  • If pressed for less than three seconds:

    • If the device is not provisioned to the Matter network, it initiates Bluetooth LE advertising for Matter commissioning. Bluetooth LE advertising makes the device discoverable over Bluetooth LE for the predefined period of time (1 hour by default).

  • If pressed for more than three seconds, it initiates the factory reset of the device. Releasing the button within three seconds of the initiation cancels the factory reset procedure.

Button 2:

Changes the lock state to the opposite one.

Button 3:

When the application is built with the dfu_smp snippet, toggles Bluetooth LE advertising for DFU over SMP.

SEGGER J-Link USB Port:

Used for getting logs from the device or for communicating with it through the command-line interface.

NFC port with antenna attached:

Optionally used for obtaining the onboarding information from the Matter accessory device to start the commissioning the device procedure while using a commercial ecosystem. See the Testing with commercial ecosystem section.

Building and running

This section describes how to build the application and commission it to the Matter network.

This application can be found under ncs-door-lock-and-access-control/applications/matter-door-lock-app in your folder structure.

To build it, follow the instructions in Building an application for your preferred building environment. See also programming for programming steps and testing for general information about testing and debugging in the nRF Connect SDK.

When building this application with Sysbuild for an SoC that has a network core, the IPC radio is automatically applied to the build. The IPC radio is one of the Companion components in the nRF Connect SDK and allows you to use the radio peripheral from another core in a multicore device. If needed, you can modify the IPC radio configuration in the prj.conf source file in the application’s sysbuild/ipc_radio directory.

Before starting the commissioning procedure, you need to enable the Bluetooth LE advertising on your device to make it discoverable. To do it, press Button 1. The device becomes discoverable automatically upon the device startup, but only for a predefined period of time (one hour by default). If the Bluetooth LE advertising times out, enable it again.

Testing

This section shows how to test the application. You can test it using your PC and the CHIP Tool for Linux or macOS or a commercial ecosystem that supports Matter.

Testing with CHIP Tool

Complete the following steps to test the Door Lock device using CHIP Tool:

Prepare Matter network

To set up the Matter over Thread, complete the following steps:

  1. Configure the Thread Border Router. See the Running OTBR using Docker section on the Thread Border Router page.

  2. Download the prebuilt CHIP tool package from the Matter nRF Connect releases GitHub page. Make sure that the package is compatible with your nRF Connect SDK version.

Prepare your DK

To flash your DK with the application and prepare it for testing, complete the following steps:

  1. Connect the kit to the computer using a USB cable. The kit is assigned a serial port. Serial ports are referred to as COM ports on Windows, /dev/ttyACM devices on Linux, and /dev/tty devices on macOS. To list Nordic Semiconductor devices connected to your computer together with their serial ports, open a terminal and run the nrfutil device list command. Alternatively, check your operating system’s device manager or its equivalent.

  2. Open a serial port connection to the kit using a terminal emulator that supports VT100/ANSI escape characters (for example, the Serial Terminal app). See Testing and optimization for the required settings and steps.

  3. If the device was not erased during the programming, perform the factory reset procedure.

    To restore the device settings and state to its factory set press Button 1 for six seconds to initiate the factory reset of the device.

Commission to Matter network

To commission the device to the Matter network complete the following steps:

  1. Obtain a Thread active dataset from OTBR:

    1. Connect to the Raspberry Pi through USB or SSH.

    2. Run the following commands:

    sudo ot-ctl
    > dataset active -x
    

    The output should look like:

    080000000000000000000300001735060004001fffe00208deadbeefcafe12340708fd123456789abc00000510112233445566778899aabbccddeeff00030a54657374576f726b3031010211220410aabbccddeeff00112233445566778899aa0c0402a0f7f8
    Done
    
  2. Run the following command and fill the <thread dataset> argument obtain in the previous step:

    chip-tool pairing ble-thread 1 hex:<thread dataset> 20202021 3840

Unlock the Door Lock Application

Send the Unlock command to the Door Lock through Matter controller. Use the following command:

chip-tool doorlock unlock-door 1 1 --timedInteractionTimeoutMs 5000

Observe that the Door Lock is unlocked.

Lock the Door Lock Application

Send the Lock command to the Door Lock through Matter controller. Use the following command:

chip-tool doorlock lock-door 1 1 --timedInteractionTimeoutMs 5000

Observe that the Door Lock is locked.

Testing with commercial ecosystem

Before starting testing, ensure that the ecosystem supports the device types enabled in this application. See the ecosystem manual page for instructions on how to use it.

When you start the commissioning procedure, the ecosystem controller must get the onboarding information from the Matter accessory device. The onboarding information representation depends on your commissioner setup.

For this application, you can use one of the following Onboarding information formats to provide the commissioner with the data payload that includes the device discriminator and the setup PIN code:

Door Lock application onboarding information

QR Code

QR Code Payload

Manual pairing code

Scan the following QR code with the app for your ecosystem:

QR code for commissioning the door lock device

MT:8IXS142C00KA0648G00

34970112332

When the factory data support is enabled, the onboarding information will be stored in the build directory in the following files:

  • The factory_data.png file includes the generated QR code.

  • The factory_data.txt file includes the QR code payload and the manual pairing code.

This data payload also includes test Device Attestation, with test Certification Declaration, Product ID, and Vendor ID. These are used for Device Attestation within commissioning, and you can generate your own test Certification Declaration by following the Testing Device Attestation during development.

Testing Door Lock Application features

Besides testing the basic functionality of the Door Lock, you can test the following features. Some of them require a different build configuration to enable. Expand the following toggles to see testing steps for each feature.

Testing remote access with PIN code credential

Note

You can test the PIN code credential support with any Matter compatible controller. The following steps use the CHIP Tool controller as an example. For more information about setting user credentials, see the Saving users and credentials on Door Lock devices section of the Matter chip-tool guide page.

  1. Prepare the development kit for testing.

  2. Make the Door Lock require a PIN code for remote operations:

    chip-tool doorlock write require-pinfor-remote-operation 1 |node_id| 1 --timedInteractionTimeoutMs 5000
    
  3. Add the example Home Door Lock user:

    chip-tool doorlock set-user 0 2 Home 123 1 0 0 |node_id| 1 --timedInteractionTimeoutMs 5000
    

    This command creates a Home user with a unique ID of 123 and an index of 2. The new user’s status is set to 1, and both its type and credential rule to 0. The user is assigned to the Door Lock cluster residing on endpoint 1 of the node with ID 10.

  4. Add the example 12345678 PIN code credential to the Home user:

    chip-tool doorlock set-credential 0 '{"credentialType": 1, "credentialIndex": 1}' 12345678 2 null null |node_id| 1 --timedInteractionTimeoutMs 5000
    
  5. Unlock the Door Lock with the given PIN code:

    chip-tool doorlock unlock-door |node_id| 1 --PINCode 12345678 --timedInteractionTimeoutMs 5000
    
  6. Reboot the device.

  7. Wait until the device has rebooted and rejoined the Matter network.

  8. Unlock the Door Lock with the PIN code provided before the reboot:

    chip-tool doorlock unlock-door |node_id| 1 --PINCode 12345678 --timedInteractionTimeoutMs 5000
    

Note

Accessing the Door Lock remotely without a valid PIN code credential will fail.

Testing scheduled timed access

Note

With scheduled timed access, you can configure and store access times on the application, but the application does not enforce those time constraints when the lock is accessed. You can add such logic in your application (BoltLockManager class) to enforce the time constraints when the lock is accessed.

Note

You can test Matter Door Lock Application features using any Matter compatible controller. The following steps use the CHIP Tool controller as an example.

All scheduled timed access entries are saved to non-volatile memory and loaded automatically after device reboot. Adding a single schedule for a user contributes to the settings partition memory occupancy increase.

  1. Prepare the development kit for testing.

  2. Add the example Home Door Lock user:

    chip-tool doorlock set-user 0 2 Home 123 1 0 0 |node_id| 1 --timedInteractionTimeoutMs 5000
    

    This command creates a Home user with a unique ID of 123 and an index of 2. The new user’s status is set to 1, and both its type and credential rule to 0. The user is assigned to the Door Lock cluster residing on endpoint 1 of the node with ID 1.

  3. Set the example Week-day schedule using the following command:

    chip-tool doorlock set-week-day-schedule weekday-index user-index days-mask start-hour start-minute end-hour end-minute destination-id endpoint-id
    • weekday-index is the index of the new schedule, starting from 1. The maximum value is defined by the CONFIG_LOCK_MAX_WEEKDAY_SCHEDULES_PER_USER Kconfig option.

    • user-index is the user index defined for the user created in the previous step.

    • days-mask is a bitmap of numbers of the week days starting from 0 as a Sunday and finishing at 6 as a Saturday. For example, to assign this schedule to Tuesday, Thursday and Saturday you need to provide 84 because it is equivalent to the 01010100 bitmap.

    • start-hour is the starting hour for the week day schedule.

    • start-minute is the starting minute for the week day schedule.

    • end-hour is the ending hour for the week day schedule.

    • end-minute is the ending minute for the week day schedule.

    • destination-id is the device node ID.

    • endpoint-id is the Matter Door Lock endpoint, in this application assigned to 1.

    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:

    chip-tool doorlock set-week-day-schedule 1 2 84 7 30 10 30 1 1
  4. Set the example Year-day schedule using the following command:

    chip-tool doorlock set-year-day-schedule yearday-index user-index localtime-start localtime-end destination-id endpoint-id
    • yearday-index is the index of the new schedule, starting from 1. The maximum value is defined by the CONFIG_LOCK_MAX_YEARDAY_SCHEDULES_PER_USER Kconfig option.

    • user-index is the user index defined for the user created in the previous step.

    • localtime-start is the starting time in Epoch Time.

    • localtime-end is the ending time in Epoch Time.

    • destination-id is the device node ID.

    • endpoint-id is the Matter Door Lock endpoint, in this application assigned to 1.

    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.

    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:

    chip-tool doorlock set-year-day-schedule 1 2 1716786000 1717045200 |node_id| 1
    
  5. Set the example Holiday schedule using the following command:

    chip-tool doorlock set-holiday-schedule holiday-index localtime-start localtime-end operating-mode destination-id endpoint-id
    • holiday-index is the index of the new schedule, starting from 1.

    • localtime-start is the starting time in Epoch Time.

    • localtime-end is the ending time in Epoch Time.

    • operating-mode is the operating mode described in the Matter Door Lock Application features section of this guide.

    • destination-id is the device node ID.

    • endpoint-id is the Matter Door Lock endpoint, in this application assigned to 1.

    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:

    chip-tool doorlock set-holiday-schedule 1 1716786000 1717045200 1 1 1
  6. Read saved schedules using the following commands and providing the same arguments you used in the earlier steps:

    chip-tool doorlock get-week-day-schedule weekday-index user-index destination-id endpoint-id
    chip-tool doorlock get-year-day-schedule yearday-index user-index destination-id endpoint-id
    chip-tool doorlock get-holiday-schedule holiday-index destination-id endpoint-id

Testing Bluetooth LE with Nordic UART Service

To test the Nordic UART Service (NUS) feature, complete the following steps:

Note

Some of the steps depend on which configuration the application was built with.

  1. Install nRF Toolbox on your Android (Android 11 or newer) or iOS (iOS 16.1 or newer) smartphone.

  2. Build the application application for Matter over Thread with the bt_nus snippet.

    Add -Dmatter-door-lock-app_SNIPPET=bt_nus to Extra CMake arguments in your build configuration.

  3. Prepare the development kit for testing.

  4. If you built the application with the debug configuration, connect the board to a UART console to see the log entries from the device.

  5. Open the nRF Toolbox application on your smartphone.

  6. Select Universal Asynchronous Receiver/Transmitter UART from the list in the nRF Toolbox application.

  7. Tap Connect. The application scans for nearby Bluetooth LE devices.

  8. Select MatterLock from the list of available devices. The Bluetooth Pairing Request with an input field for passkey appears as a notification (Android) or on the screen (iOS).

  9. Depending on the configuration you are using:

    • If you rely on CONFIG_DOOR_LOCK_BLE_MANAGER_AUTH_APP_PASSKEY (default 123456): Enter that passkey on the phone.

    • If the device prints a passkey to the log, complete the following steps:

      1. Search the device’s logs to find PROVIDE THE FOLLOWING CODE IN YOUR MOBILE APP: phrase.

      2. Read the passkey from the console logs.

      3. Enter the passcode on your smartphone.

  10. Wait for the Bluetooth LE connection to be established between the smartphone and the DK.

  11. In the nRF Toolbox application, add the following macros:

    • Lock as the Command value type Text and any image.

    • Unlock as the Command value type Text and any image.

  12. Tap the generated macros to change the lock state.

The Bluetooth LE connection between a phone and the DK will be suspended when the commissioning to the Matter network is in progress or there is an active session of SMP DFU.

To read the current application state from the device, read the Bluetooth LE RX characteristic. The new lock state is updated after changing the state from any of the following sources: NUS, buttons, Matter stack.

Dependencies

This application uses the Matter library that includes the nRF Connect SDK platform integration layer:

In addition, the application uses the following nRF Connect SDK components:

The application depends on the following Zephyr libraries: