Skip to content

Commit

Permalink
samples: matter: added thermostat sample application
Browse files Browse the repository at this point in the history
Created example application for thermostat device,
able to read temperature from external temperature
sensor or use mocked temperature values.

Signed-off-by: Patryk Lipinski <patryk.lipinski@nordicsemi.no>
  • Loading branch information
LipinskiPNordicSemi authored and LuDuda committed Jul 24, 2023
1 parent 2f3754d commit 441da6d
Show file tree
Hide file tree
Showing 63 changed files with 14,465 additions and 31 deletions.
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 @@ -341,6 +341,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
- ✔
- ✔
- ✔
- ✔
- ✔
-
* - 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.



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

0 comments on commit 441da6d

Please sign in to comment.