Skip to content

feat(matter): enables BLE Matter commissioning with NimBLE #11537

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

Open
wants to merge 6 commits into
base: release/v3.3.x
Choose a base branch
from

Conversation

SuGlider
Copy link
Collaborator

@SuGlider SuGlider commented Jul 2, 2025

Description of Change

Given that Arduino Core 3.3.x will support NimBLE, it is now possible to enable Matter network commissioning using BLE.
This PR changes examples and Matter Library code in order to make it work.

This must be done case by case because each SoC has certain limitations:

CONFIG_ENABLE_CHIPOBLE=n

  • ESP32: uses Bluedroid, therefore it can't use NimBLE, neither CHIPOBLE
  • ESP32S2: has no BLE, therefore it can't use NimBLE, neither CHIPOBLE

CONFIG_ENABLE_CHIPOBLE=y

  • ESP32-S3: has NimBLE and shall use CHIPOBLE for commissioning WiFi only
  • ESP32-C3: has NimBLE and shall use CHIPOBLE for commissioning WiFi only
  • ESP32-C5: has NimBLE and shall use CHIPOBLE for commissioning WiFi or Thread(*)
  • ESP32-C6: has NimBLE and shall use CHIPOBLE for commissioning WiFi or Thread(*)
  • ESP32-H2: has NimBLE and shall use CHIPOBLE for commissioning Thread only

(*) some extra chnages are necessary in order to make Matter run the commissioning for a Thread Network.

No Matter Support with Arduino:

  • ESP32-P4: No Wireless interface. Possible to get it done a C6/H2 wireless Slave configuration for WiFi/Thread.
  • ESP32-C2: Problems building it within Arduino standard configuration.

Tests scenarios

Using the examples with ESP32, S2, S3, C3, C5, C6, and H2.

Related links

#11531

@SuGlider SuGlider added this to the 3.3.0 milestone Jul 2, 2025
@SuGlider SuGlider self-assigned this Jul 2, 2025
@SuGlider SuGlider added Status: Review needed Issue or PR is awaiting review Area: Matter Issues and Feature Request about Matter Protocol labels Jul 2, 2025
@SuGlider SuGlider requested a review from Copilot July 2, 2025 03:33
Copy link
Contributor

github-actions bot commented Jul 2, 2025

Warnings
⚠️
	The **target branch** for this Pull Request **must be the default branch** of the project (`master`).

	If you would like to add this feature to a different branch, please state this in the PR description and we will consider it.

👋 Hello SuGlider, we appreciate your contribution to this project!


📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against f4b7ba6

@SuGlider SuGlider mentioned this pull request Jul 2, 2025
Copy link
Contributor

github-actions bot commented Jul 2, 2025

Test Results

 76 files   76 suites   13m 10s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit f4b7ba6.

♻️ This comment has been updated with latest results.

@SuGlider SuGlider moved this from Todo to In Review in Arduino ESP32 Core Project Roadmap Jul 2, 2025
Copilot

This comment was marked as outdated.

@SuGlider SuGlider requested a review from Copilot July 2, 2025 03:41
Copilot

This comment was marked as outdated.

@SuGlider SuGlider requested a review from Copilot July 2, 2025 03:52
Copilot

This comment was marked as outdated.

@SuGlider SuGlider requested a review from Copilot July 2, 2025 04:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables BLE-based Matter commissioning using NimBLE, refactors the core MatterEndPoint interface for better separation of interface and implementation, and adjusts example sketches to conditionally include Wi-Fi only when BLE commissioning is disabled.

  • Introduced MatterEndPoint.cpp with implementations for endpoint management and a new secondary network interface for Thread.
  • Refactored MatterEndPoint.h to declare methods (moving inline implementations into the .cpp) and added Thread commissioning support in Matter.cpp.
  • Updated all example sketches to wrap Wi-Fi includes and connection code in #if !CONFIG_ENABLE_CHIPOBLE and changed log messages to "connected to the network."

Reviewed Changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libraries/Matter/src/MatterEndpoints/*.h/.cpp Bumped copyright year and added blank line before started = true; in begin() methods
libraries/Matter/src/MatterEndPoint.h Refactored class interface, added declarations for new methods and secondary network interface support
libraries/Matter/src/MatterEndPoint.cpp New implementation for MatterEndPoint methods
libraries/Matter/src/Matter.cpp Added conditional Thread commissioning configuration block
libraries/Matter/examples/*/*.ino Wrapped Wi-Fi code in BLE-commissioning guard and updated log text
Comments suppressed due to low confidence (4)

libraries/Matter/src/MatterEndPoint.cpp:26

  • Returning false when a secondary interface already exists may mislead consumers who only need to know it is available. Consider returning true or using a distinct status code to indicate 'already initialized'.
  if (secondary_network_endpoint_id != 0) {

libraries/Matter/src/MatterEndPoint.cpp:33

  • The commented-out WiFi feature map entry could be confusing. Add a TODO or parameterize feature selection so it's clear whether WiFi commissioning is intended in the future.
    //chip::app::Clusters::NetworkCommissioning::Feature::kWiFiNetworkInterface) |

libraries/Matter/src/Matter.cpp:20

  • [nitpick] Consider adding a brief comment above this block to explain the Thread commissioning configuration parameters and when this block is enabled.
#if CONFIG_ENABLE_MATTER_OVER_THREAD

Copy link
Contributor

github-actions bot commented Jul 2, 2025

Memory usage test (comparing PR against master branch)

The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.

MemoryFLASH [bytes]FLASH [%]RAM [bytes]RAM [%]
TargetDECINCDECINCDECINCDECINC
ESP32C5000.000.00000.000.00
ESP32S3000.000.00000.000.00
ESP32S2000.000.00000.000.00
ESP32C3000.000.00000.000.00
ESP32C6000.000.00000.000.00
ESP32000.000.00000.000.00
Click to expand the detailed deltas report [usage change in BYTES]
TargetESP32C5ESP32S3ESP32S2ESP32C3ESP32C6ESP32
ExampleFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAMFLASHRAM
libraries/Matter/examples/MatterColorLight------------
libraries/Matter/examples/MatterCommissionTest------------
libraries/Matter/examples/MatterComposedLights------------
libraries/Matter/examples/MatterContactSensor------------
libraries/Matter/examples/MatterDimmableLight------------
libraries/Matter/examples/MatterEnhancedColorLight------------
libraries/Matter/examples/MatterEvents------------
libraries/Matter/examples/MatterFan------------
libraries/Matter/examples/MatterHumiditySensor------------
libraries/Matter/examples/MatterMinimum------------
libraries/Matter/examples/MatterOccupancySensor------------
libraries/Matter/examples/MatterOnIdentify------------
libraries/Matter/examples/MatterOnOffLight------------
libraries/Matter/examples/MatterOnOffPlugin------------
libraries/Matter/examples/MatterPressureSensor------------
libraries/Matter/examples/MatterSmartButon------------
libraries/Matter/examples/MatterTemperatureLight------------
libraries/Matter/examples/MatterTemperatureSensor------------
libraries/Matter/examples/MatterThermostat------------
libraries/Matter/examples/WiFiProvWithinMatter------------

@me-no-dev me-no-dev removed the Status: Review needed Issue or PR is awaiting review label Jul 2, 2025
@me-no-dev me-no-dev added the Status: Pending Merge Pull Request is ready to be merged label Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Matter Issues and Feature Request about Matter Protocol Status: Pending Merge Pull Request is ready to be merged
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

3 participants