Skip to content

Commit c6a3bcb

Browse files
authored
feat(matter): removing wifi requirement for H2 and C5 (#11581)
This PR removes WiFi provisioning support from CI and examples (shifting to Thread/BLE provisioning), updates the CI configs for all Matter examples to drop the WiFi requirement, and adds new API keywords and a fresh “LambdaSingleCallbackManyEPs” example. - Deleted the WiFiProvWithinMatter example (its .ino and ci.json) since BLE is now used for provisioning. - Stripped "CONFIG_SOC_WIFI_SUPPORTED=y" from the CI JSON of existing examples to test Thread-only builds. - Updated keywords.txt with new Matter API identifiers and introduced a new “LambdaSingleCallbackManyEPs” example with CI and source
1 parent fbf3c11 commit c6a3bcb

File tree

24 files changed

+153
-191
lines changed

24 files changed

+153
-191
lines changed
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"fqbn_append": "PartitionScheme=huge_app",
3-
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
5-
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
6-
]
7-
}
2+
"fqbn_append": "PartitionScheme=huge_app",
3+
"requires": [
4+
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
5+
]
6+
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"fqbn_append": "PartitionScheme=huge_app",
33
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
54
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
65
]
76
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"fqbn_append": "PartitionScheme=huge_app",
33
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
54
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
65
]
76
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"fqbn_append": "PartitionScheme=huge_app",
33
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
54
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
65
]
76
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"fqbn_append": "PartitionScheme=huge_app",
33
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
54
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
65
]
76
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"fqbn_append": "PartitionScheme=huge_app",
3-
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
5-
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
6-
]
2+
"fqbn_append": "PartitionScheme=huge_app",
3+
"requires": [
4+
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
5+
]
76
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"fqbn_append": "PartitionScheme=huge_app",
33
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
54
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
65
]
76
}
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"fqbn_append": "PartitionScheme=huge_app",
3-
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
5-
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
6-
]
2+
"fqbn_append": "PartitionScheme=huge_app",
3+
"requires": [
4+
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
5+
]
76
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"fqbn_append": "PartitionScheme=huge_app",
33
"requires": [
4-
"CONFIG_SOC_WIFI_SUPPORTED=y",
54
"CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y"
65
]
76
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
// Copyright 2025 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/*
16+
This example create 6 on-off light endpoint that share the same onChangeOnOff() callback code.
17+
It uses Lambda Function with an extra Lambda Capture information that links the Endpoint to its individual information.
18+
After the Matter example is commissioned, the expected Serial output shall be similar to this:
19+
20+
Matter App Control: 'Room 1' (OnOffLight[0], Endpoint 1, GPIO 2) changed to: OFF
21+
Matter App Control: 'Room 1' (OnOffLight[0], Endpoint 1, GPIO 2) changed to: ON
22+
Matter App Control: 'Room 5' (OnOffLight[4], Endpoint 5, GPIO 10) changed to: ON
23+
Matter App Control: 'Room 2' (OnOffLight[1], Endpoint 2, GPIO 4) changed to: ON
24+
Matter App Control: 'Room 4' (OnOffLight[3], Endpoint 4, GPIO 8) changed to: ON
25+
Matter App Control: 'Room 6' (OnOffLight[5], Endpoint 6, GPIO 12) changed to: ON
26+
Matter App Control: 'Room 3' (OnOffLight[2], Endpoint 3, GPIO 6) changed to: ON
27+
Matter App Control: 'Room 5' (OnOffLight[4], Endpoint 5, GPIO 10) changed to: OFF
28+
*/
29+
30+
// Matter Manager
31+
#include <Matter.h>
32+
#include <Preferences.h>
33+
#if !CONFIG_ENABLE_CHIPOBLE
34+
// if the device can be commissioned using BLE, WiFi is not used - save flash space
35+
#include <WiFi.h>
36+
// CONFIG_ENABLE_CHIPOBLE is enabled when BLE is used to commission the Matter Network
37+
// WiFi is manually set and started
38+
const char *ssid = "your-ssid"; // Change this to your WiFi SSID
39+
const char *password = "your-password"; // Change this to your WiFi password
40+
#endif
41+
42+
//number of On-Off Lights:
43+
const uint8_t MAX_LIGHT_NUMBER = 6;
44+
45+
// array of OnOffLight endpoints
46+
MatterOnOffLight OnOffLight[MAX_LIGHT_NUMBER];
47+
48+
// all pins, one for each on-off light
49+
uint8_t lightPins[MAX_LIGHT_NUMBER] = {2, 4, 6, 8, 10, 12}; // must replace it by the real pin for the target SoC and application
50+
51+
// friendly OnOffLights names used for printing a message in the callback
52+
const char *lightName[MAX_LIGHT_NUMBER] = {
53+
"Room 1", "Room 2", "Room 3", "Room 4", "Room 5", "Room 6",
54+
};
55+
56+
// simple setup() function
57+
void setup() {
58+
Serial.begin(115200); // callback will just print a message in the console
59+
60+
// CONFIG_ENABLE_CHIPOBLE is enabled when BLE is used to commission the Matter Network
61+
#if !CONFIG_ENABLE_CHIPOBLE
62+
// We start by connecting to a WiFi network
63+
Serial.print("Connecting to ");
64+
Serial.println(ssid);
65+
// Manually connect to WiFi
66+
WiFi.begin(ssid, password);
67+
// Wait for connection
68+
while (WiFi.status() != WL_CONNECTED) {
69+
delay(500);
70+
Serial.print(".");
71+
}
72+
Serial.println("\r\nWiFi connected");
73+
Serial.println("IP address: ");
74+
Serial.println(WiFi.localIP());
75+
delay(500);
76+
#endif
77+
78+
// setup all the OnOff Light endpoint and their lambda callback functions
79+
for (uint8_t i = 0; i < MAX_LIGHT_NUMBER; i++) {
80+
pinMode(lightPins[i], OUTPUT); // set the GPIO function
81+
OnOffLight[i].begin(false); // off
82+
83+
// inline lambda function using capture array index -> it will just print a message in the console
84+
OnOffLight[i].onChangeOnOff([i](bool state) -> bool {
85+
// Display message with the specific light name and details
86+
Serial.printf(
87+
"Matter App Control: '%s' (OnOffLight[%d], Endpoint %d, GPIO %d) changed to: %s\r\n", lightName[i], i, OnOffLight[i].getEndPointId(), lightPins[i],
88+
state ? "ON" : "OFF"
89+
);
90+
91+
return true;
92+
});
93+
}
94+
// last step, starting Matter Stack
95+
Matter.begin();
96+
}
97+
98+
void loop() {
99+
// Check Matter Plugin Commissioning state, which may change during execution of loop()
100+
if (!Matter.isDeviceCommissioned()) {
101+
Serial.println("");
102+
Serial.println("Matter Node is not commissioned yet.");
103+
Serial.println("Initiate the device discovery in your Matter environment.");
104+
Serial.println("Commission it to your Matter hub with the manual pairing code or QR code");
105+
Serial.printf("Manual pairing code: %s\r\n", Matter.getManualPairingCode().c_str());
106+
Serial.printf("QR code URL: %s\r\n", Matter.getOnboardingQRCodeUrl().c_str());
107+
// waits for Matter Plugin Commissioning.
108+
uint32_t timeCount = 0;
109+
while (!Matter.isDeviceCommissioned()) {
110+
delay(100);
111+
if ((timeCount++ % 50) == 0) { // 50*100ms = 5 sec
112+
Serial.println("Matter Node not commissioned yet. Waiting for commissioning.");
113+
}
114+
}
115+
} else {
116+
if (Matter.isDeviceConnected()) {
117+
Serial.println("Matter Node is commissioned and connected to the network. Ready for use.");
118+
} else {
119+
Serial.println("Matter Node is commissioned. Waiting for the network connection.");
120+
}
121+
// wait 3 seconds for the network connection
122+
delay(3000);
123+
}
124+
125+
delay(100);
126+
}

0 commit comments

Comments
 (0)