Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samples: matter: added thermostat sample application #11737

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/nrf/images/matter_qr_code_thermostat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 43 additions & 31 deletions doc/nrf/protocols/matter/getting_started/hw_requirements.rst

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ Matter samples
Previously, it was set incorrectly.
* Fixed the cluster revision for basic information cluster.
Previously, it was set incorrectly.
* Added :ref:`Matter thermostat <matter_thermostat_sample>` sample.

NFC samples
-----------
Expand Down
8 changes: 8 additions & 0 deletions doc/nrf/samples/matter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,56 @@ The following table lists variants and extensions available out of the box for e
- Door lock
- Template
- Window covering
- Thermostat
* - FEM support
- ✔
- ✔
- ✔
- ✔
- ✔
-
LipinskiPNordicSemi marked this conversation as resolved.
Show resolved Hide resolved
* - DFU support
- ✔
- ✔
- ✔
- ✔
- ✔
- ✔
* - Thread support
- ✔
- ✔
- ✔
- ✔
- ✔
- ✔
* - :ref:`Thread role <thread_ot_device_types>`
- Router
- SED
- SED
- MED
- SSED
-
* - Wi-Fi support
- ✔
- ✔
- ✔
- ✔
-
- ✔
* - Thread and Wi-Fi switching
-
-
- ✔
-
-
-
* - Low power configuration by default
-
- ✔
- ✔
-
- ✔
-

See the sample documentation pages for instructions about how to enable these variants and extensions.

Expand Down
6 changes: 6 additions & 0 deletions samples/matter/light_switch/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,20 @@ This allows the light switch more than one lighting devices at the same time.
Binding
=======

.. matter_light_switch_sample_binding_start

Binding refers to establishing a relationship between endpoints on the local and remote nodes.
With binding, local endpoints are pointed and bound to the corresponding remote endpoints.
Both must belong to the same cluster type.
Binding lets the local endpoint know which endpoints are going to be the target for the client-generated actions on one or more remote nodes.

.. matter_light_switch_sample_binding_end

In this sample, the light switch controls one or more lighting devices, but does not know the remote endpoints of the lights (on remote nodes).
Using binding, the light switch device updates its Binding cluster with all relevant information about the lighting devices, such as their IPv6 address, node ID, and the IDs of the remote endpoints that contains the On/Off cluster and the LevelControl cluster, respectively.



LipinskiPNordicSemi marked this conversation as resolved.
Show resolved Hide resolved
Configuration
*************

Expand Down
74 changes: 74 additions & 0 deletions samples/matter/thermostat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
# Copyright (c) 2023 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

# Set Kconfig root files that will be processed as a first Kconfig for used child images.
set(mcuboot_KCONFIG_ROOT "\\\${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/chip-module/Kconfig.mcuboot.root")
set(multiprotocol_rpmsg_KCONFIG_ROOT "\\\${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/chip-module/Kconfig.multiprotocol_rpmsg.root")
set(hci_rpmsg_KCONFIG_ROOT "\\\${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/chip-module/Kconfig.hci_rpmsg.root")

# For prj.conf the CONF_FILE is empty. In other case extract the exact file name from the path string.
if(CONF_FILE)
get_filename_component(CONFIG_FILE_NAME ${CONF_FILE} NAME)
endif()

if(NOT CONFIG_FILE_NAME STREQUAL "prj_no_dfu.conf")
set(PM_STATIC_YML_FILE ${CMAKE_CURRENT_SOURCE_DIR}/configuration/${BOARD}/pm_static_dfu.yml)
endif()

find_package(Zephyr HINTS $ENV{ZEPHYR_BASE})

project(matter-template)

set(COMMON_ROOT ${ZEPHYR_NRF_MODULE_DIR}/samples/matter/common)
set(NLIO_ROOT ${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/third_party/nlio/repo)
include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/config/nrfconnect/app/enable-gnu-std.cmake)
include(${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/src/app/chip_data_model.cmake)

# NORDIC SDK APP START
target_include_directories(app PRIVATE
src
${COMMON_ROOT}/src
${NLIO_ROOT}/include
${ZEPHYR_CONNECTEDHOMEIP_MODULE_DIR}/zzz_generated/app-common
)

target_sources(app PRIVATE
src/app_task.cpp
src/main.cpp
src/temp_sensor_manager.cpp
src/temperature_manager.cpp
src/zcl_callbacks.cpp
src/zap-generated/IMClusterCommandHandler.cpp
src/zap-generated/callback-stub.cpp
src/binding_handler.cpp
${COMMON_ROOT}/src/led_widget.cpp
)


if(CONFIG_CHIP_OTA_REQUESTOR OR CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${COMMON_ROOT}/src/ota_util.cpp)
endif()

if(CONFIG_MCUMGR_TRANSPORT_BT)
target_sources(app PRIVATE ${COMMON_ROOT}/src/dfu_over_smp.cpp)
endif()

if(CONFIG_THERMOSTAT_EXTERNAL_SENSOR)
target_sources(app PRIVATE src/temperature_measurement/real_temp.cpp)
else()
target_sources(app PRIVATE src/temperature_measurement/simulated_temp.cpp)
endif()


chip_configure_data_model(app
INCLUDE_SERVER
BYPASS_IDL
GEN_DIR src/zap-generated
ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/thermostat.zap
)
# NORDIC SDK APP END
49 changes: 49 additions & 0 deletions samples/matter/thermostat/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Copyright (c) 2023 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
mainmenu "Matter Thermostat sample application"

config THERMOSTAT_EXTERNAL_SENSOR
bool "Select if the temperature measurement is provided directly from an external sensor."
help
Set to true to enable the temperature measurement from a physical external sensor. Set to false to simulate the temperature measurement.

config THERMOSTAT_TEMPERATURE_STEP
int "Defines a simulated temperature step. Use 0 for random."
default 0
help
A temperature step that defines differences between consecutive simulated temperature measurements. If set to 0, then the step is random.

config THERMOSTAT_SIMULATED_TEMPERATURE_MAX
int "Maximum simulated temperature value."
default 3000

config THERMOSTAT_SIMULATED_TEMPERATURE_MIN
int "Minimum simulated temperature value."
default 1500

config THERMOSTAT_SIMULATED_TEMPERATURE_CHANGE
bool "Select to set the temperature to rise or fall."
default y
help
If set to true, the simulated temperature is rising. If set to false, the simulated temperature is falling.


# Sample configuration used for Thread networking
if NET_L2_OPENTHREAD

choice OPENTHREAD_NORDIC_LIBRARY_CONFIGURATION
default OPENTHREAD_NORDIC_LIBRARY_MTD
endchoice

choice OPENTHREAD_DEVICE_TYPE
default OPENTHREAD_MTD
endchoice

endif # NET_L2_OPENTHREAD

source "${ZEPHYR_BASE}/../modules/lib/matter/config/nrfconnect/chip-module/Kconfig.features"
source "${ZEPHYR_BASE}/../modules/lib/matter/config/nrfconnect/chip-module/Kconfig.defaults"
source "Kconfig.zephyr"
Loading
Loading