diff --git a/docs/_static/matter_erase_flash.png b/docs/_static/matter_erase_flash.png new file mode 100644 index 00000000000..621fbe9a5b2 Binary files /dev/null and b/docs/_static/matter_erase_flash.png differ diff --git a/docs/_static/matter_partition_scheme.png b/docs/_static/matter_partition_scheme.png new file mode 100644 index 00000000000..f835e8b7268 Binary files /dev/null and b/docs/_static/matter_partition_scheme.png differ diff --git a/docs/en/matter/matter.rst b/docs/en/matter/matter.rst index 69bcf10603c..4c4ed4a5a18 100644 --- a/docs/en/matter/matter.rst +++ b/docs/en/matter/matter.rst @@ -16,6 +16,30 @@ The Matter library provides support for creating Matter-compatible devices inclu The Matter library is built on top of `ESP Matter SDK `_ and provides a high-level Arduino-style interface for creating Matter devices. +Building and Flashing Matter Examples +-------------------------------------- + +Before uploading any Matter example sketch, it is necessary to configure the Arduino IDE with the following settings: + +1. **Partition Scheme**: Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. + + .. figure:: ../../_static/matter_partition_scheme.png + :align: center + :alt: "Partition Scheme: Huge APP (3MB No OTA/1MB SPIFFS)" Arduino IDE menu option + :figclass: align-center + +2. **Erase Flash**: Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. + + .. figure:: ../../_static/matter_erase_flash.png + :align: center + :alt: "Erase All Flash Before Sketch Upload: Enabled" Arduino IDE menu option + :figclass: align-center + +These settings are required for the following reasons: + +* **Partition Scheme**: Matter firmware requires a large application partition (3MB) to accommodate the Matter stack and application code. +* **Erase Flash**: Erasing flash is necessary to remove any leftover WiFi or Matter configuration from the NVS (Non-Volatile Storage) partition. Without erasing, previous network credentials, Matter fabric information, or device commissioning data may interfere with the new firmware, causing commissioning failures or connectivity issues. + Matter Protocol Overview ************************ @@ -83,9 +107,13 @@ The ``Matter`` class provides the following key methods: * ``begin()``: Initializes the Matter stack * ``isDeviceCommissioned()``: Checks if the device is commissioned -* ``isWi-FiConnected()``: Checks Wi-Fi connection status (if Wi-Fi is enabled) -* ``isThreadConnected()``: Checks Thread connection status (if Thread is enabled) +* ``isWiFiConnected()``: Checks Wi-Fi connection status +* ``isThreadConnected()``: Checks Thread connection status * ``isDeviceConnected()``: Checks overall device connectivity +* ``isWiFiStationEnabled()``: Checks if WiFi Station mode is supported and enabled +* ``isWiFiAccessPointEnabled()``: Checks if WiFi AP mode is supported and enabled +* ``isThreadEnabled()``: Checks if Thread network is supported and enabled +* ``isBLECommissioningEnabled()``: Checks if BLE commissioning is supported and enabled * ``decommission()``: Factory resets the device * ``getManualPairingCode()``: Gets the manual pairing code for commissioning * ``getOnboardingQRCodeUrl()``: Gets the QR code URL for commissioning @@ -148,6 +176,55 @@ The library provides specialized endpoint classes for different device types. Ea ep_* +Matter Examples +--------------- + +The Matter library includes a comprehensive set of examples demonstrating various device types and use cases. All examples are available in the `ESP Arduino GitHub repository `_. + +**Basic Examples:** + +* **Matter Minimum** - The smallest code required to create a Matter-compatible device. Ideal starting point for understanding Matter basics. `View Matter Minimum code on GitHub `_ +* **Matter Status** - Demonstrates how to check enabled Matter features and connectivity status. Implements a basic on/off light and periodically reports capability and connection status. `View Matter Status code on GitHub `_ +* **Matter Events** - Shows how to monitor and handle Matter events. Provides a comprehensive view of all Matter events during device operation. `View Matter Events code on GitHub `_ +* **Matter Commission Test** - Tests Matter commissioning functionality with automatic decommissioning after a 30-second delay for continuous testing cycles. `View Matter Commission Test code on GitHub `_ + +**Lighting Examples:** + +* **Matter On/Off Light** - Creates a Matter-compatible on/off light device with commissioning, device control via smart home ecosystems, and manual control using a physical button with state persistence. `View Matter On/Off Light code on GitHub `_ +* **Matter Dimmable Light** - Creates a Matter-compatible dimmable light device with brightness control. `View Matter Dimmable Light code on GitHub `_ +* **Matter Color Temperature Light** - Creates a Matter-compatible color temperature light device with adjustable color temperature control. `View Matter Color Temperature Light code on GitHub `_ +* **Matter Color Light** - Creates a Matter-compatible color light device with RGB color control (HSV color model). `View Matter Color Light code on GitHub `_ +* **Matter Enhanced Color Light** - Creates a Matter-compatible enhanced color light with color temperature and brightness control. `View Matter Enhanced Color Light code on GitHub `_ +* **Matter Composed Lights** - Creates a Matter node with multiple light endpoints (On/Off Light, Dimmable Light, and Color Light) in a single node. `View Matter Composed Lights code on GitHub `_ +* **Matter On Identify** - Implements the Matter Identify cluster callback for an on/off light device, making the LED blink when the device is identified from a Matter app. `View Matter On Identify code on GitHub `_ + +**Sensor Examples:** + +* **Matter Temperature Sensor** - Creates a Matter-compatible temperature sensor device with sensor data reporting to smart home ecosystems. `View Matter Temperature Sensor code on GitHub `_ +* **Matter Humidity Sensor** - Creates a Matter-compatible humidity sensor device with sensor data reporting. `View Matter Humidity Sensor code on GitHub `_ +* **Matter Pressure Sensor** - Creates a Matter-compatible pressure sensor device with automatic simulation of pressure readings. `View Matter Pressure Sensor code on GitHub `_ +* **Matter Contact Sensor** - Creates a Matter-compatible contact sensor device (open/closed state). `View Matter Contact Sensor code on GitHub `_ +* **Matter Occupancy Sensor** - Creates a Matter-compatible occupancy sensor device with automatic simulation of occupancy state changes. `View Matter Occupancy Sensor code on GitHub `_ +* **Matter Water Leak Detector** - Creates a Matter-compatible water leak detector device with automatic simulation of water leak detection state changes. `View Matter Water Leak Detector code on GitHub `_ +* **Matter Water Freeze Detector** - Creates a Matter-compatible water freeze detector device with automatic simulation of water freeze detection state changes. `View Matter Water Freeze Detector code on GitHub `_ +* **Matter Rain Sensor** - Creates a Matter-compatible rain sensor device with automatic simulation of rain detection state changes. `View Matter Rain Sensor code on GitHub `_ + +**Control Examples:** + +* **Matter Fan** - Creates a Matter-compatible fan device with speed and mode control. `View Matter Fan code on GitHub `_ +* **Matter Thermostat** - Creates a Matter-compatible thermostat device with temperature setpoint management and simulated heating/cooling systems with automatic temperature regulation. `View Matter Thermostat code on GitHub `_ +* **Matter Temperature Controlled Cabinet** - Creates a Matter-compatible temperature controlled cabinet device with precise temperature setpoint control with min/max limits (temperature_number mode). `View Matter Temperature Controlled Cabinet code on GitHub `_ +* **Matter Temperature Controlled Cabinet Levels** - Creates a Matter-compatible temperature controlled cabinet device using predefined temperature levels (temperature_level mode). `View Matter Temperature Controlled Cabinet Levels code on GitHub `_ +* **Matter On/Off Plugin** - Creates a Matter-compatible on/off plugin unit (power relay) device with state persistence for power control applications. `View Matter On/Off Plugin code on GitHub `_ +* **Matter Dimmable Plugin** - Creates a Matter-compatible dimmable plugin unit (power outlet with level control) device with state persistence for dimmable power control applications. `View Matter Dimmable Plugin code on GitHub `_ +* **Matter Smart Button** - Creates a Matter-compatible smart button (generic switch) device that sends button click events to smart home ecosystems and triggers automations. `View Matter Smart Button code on GitHub `_ +* **Matter Window Covering** - Creates a Matter-compatible window covering device with lift and tilt control (blinds, shades) with manual control using a physical button. `View Matter Window Covering code on GitHub `_ +* **Matter Simple Blinds** - A minimal example that only controls lift percentage using a single onGoToLiftPercentage() callback. `View Matter Simple Blinds code on GitHub `_ + +**Advanced Examples:** + +* **Matter Lambda Single Callback Many Endpoints** - Demonstrates how to create multiple Matter endpoints in a single node using a shared lambda function callback with capture for efficient callback handling. `View Matter Lambda Single Callback Many Endpoints code on GitHub `_ + Common Problems and Issues -------------------------- diff --git a/libraries/Matter/examples/MatterColorLight/README.md b/libraries/Matter/examples/MatterColorLight/README.md index 4d9e39e4f75..4f18233cb21 100644 --- a/libraries/Matter/examples/MatterColorLight/README.md +++ b/libraries/Matter/examples/MatterColorLight/README.md @@ -78,8 +78,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterColorLight.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterCommissionTest/README.md b/libraries/Matter/examples/MatterCommissionTest/README.md index db5d0e158ea..86bab465b22 100644 --- a/libraries/Matter/examples/MatterCommissionTest/README.md +++ b/libraries/Matter/examples/MatterCommissionTest/README.md @@ -59,8 +59,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterCommissionTest.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterComposedLights/README.md b/libraries/Matter/examples/MatterComposedLights/README.md index 96446810f9f..5dc1e3839a7 100644 --- a/libraries/Matter/examples/MatterComposedLights/README.md +++ b/libraries/Matter/examples/MatterComposedLights/README.md @@ -74,8 +74,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterComposedLights.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterContactSensor/README.md b/libraries/Matter/examples/MatterContactSensor/README.md index 0f54a8f0010..91729a3c4a1 100644 --- a/libraries/Matter/examples/MatterContactSensor/README.md +++ b/libraries/Matter/examples/MatterContactSensor/README.md @@ -78,8 +78,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterContactSensor.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterDimmableLight/README.md b/libraries/Matter/examples/MatterDimmableLight/README.md index f1381b2641c..071c3ae689a 100644 --- a/libraries/Matter/examples/MatterDimmableLight/README.md +++ b/libraries/Matter/examples/MatterDimmableLight/README.md @@ -79,8 +79,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterDimmableLight.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterDimmablePlugin/README.md b/libraries/Matter/examples/MatterDimmablePlugin/README.md index d823c5c1ca7..6104d520b8f 100644 --- a/libraries/Matter/examples/MatterDimmablePlugin/README.md +++ b/libraries/Matter/examples/MatterDimmablePlugin/README.md @@ -82,8 +82,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterDimmablePlugin.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterEnhancedColorLight/README.md b/libraries/Matter/examples/MatterEnhancedColorLight/README.md index 100c216cedf..5485fb33b2c 100644 --- a/libraries/Matter/examples/MatterEnhancedColorLight/README.md +++ b/libraries/Matter/examples/MatterEnhancedColorLight/README.md @@ -81,8 +81,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterEnhancedColorLight.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterEvents/README.md b/libraries/Matter/examples/MatterEvents/README.md index 985fb8748e5..ab902f477da 100644 --- a/libraries/Matter/examples/MatterEvents/README.md +++ b/libraries/Matter/examples/MatterEvents/README.md @@ -62,8 +62,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterEvents.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterFan/README.md b/libraries/Matter/examples/MatterFan/README.md index cae9e15ba5f..9bd63e63279 100644 --- a/libraries/Matter/examples/MatterFan/README.md +++ b/libraries/Matter/examples/MatterFan/README.md @@ -89,8 +89,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterFan.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterHumiditySensor/README.md b/libraries/Matter/examples/MatterHumiditySensor/README.md index 838073093cf..1a40efaad1a 100644 --- a/libraries/Matter/examples/MatterHumiditySensor/README.md +++ b/libraries/Matter/examples/MatterHumiditySensor/README.md @@ -76,8 +76,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterHumiditySensor.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterLambdaSingleCallbackManyEPs/README.md b/libraries/Matter/examples/MatterLambdaSingleCallbackManyEPs/README.md index 62c923e3655..150d475d431 100644 --- a/libraries/Matter/examples/MatterLambdaSingleCallbackManyEPs/README.md +++ b/libraries/Matter/examples/MatterLambdaSingleCallbackManyEPs/README.md @@ -98,8 +98,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterLambdaSingleCallbackManyEPs.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterMinimum/README.md b/libraries/Matter/examples/MatterMinimum/README.md index b3687718543..aaf0420a82d 100644 --- a/libraries/Matter/examples/MatterMinimum/README.md +++ b/libraries/Matter/examples/MatterMinimum/README.md @@ -78,8 +78,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterMinimum.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterOccupancySensor/README.md b/libraries/Matter/examples/MatterOccupancySensor/README.md index cb38c63ac6a..aa780625218 100644 --- a/libraries/Matter/examples/MatterOccupancySensor/README.md +++ b/libraries/Matter/examples/MatterOccupancySensor/README.md @@ -79,8 +79,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterOccupancySensor.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterOnIdentify/README.md b/libraries/Matter/examples/MatterOnIdentify/README.md index ce873f9397f..57e32fc5440 100644 --- a/libraries/Matter/examples/MatterOnIdentify/README.md +++ b/libraries/Matter/examples/MatterOnIdentify/README.md @@ -79,8 +79,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterOnIdentify.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterOnOffLight/README.md b/libraries/Matter/examples/MatterOnOffLight/README.md index b973302129a..04341b7bd69 100644 --- a/libraries/Matter/examples/MatterOnOffLight/README.md +++ b/libraries/Matter/examples/MatterOnOffLight/README.md @@ -79,8 +79,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterOnOffLight.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterOnOffPlugin/README.md b/libraries/Matter/examples/MatterOnOffPlugin/README.md index 2603961353c..f69ae65ed93 100644 --- a/libraries/Matter/examples/MatterOnOffPlugin/README.md +++ b/libraries/Matter/examples/MatterOnOffPlugin/README.md @@ -80,8 +80,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterOnOffPlugin.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterPressureSensor/README.md b/libraries/Matter/examples/MatterPressureSensor/README.md index 2f0665067ac..49d70d7cf07 100644 --- a/libraries/Matter/examples/MatterPressureSensor/README.md +++ b/libraries/Matter/examples/MatterPressureSensor/README.md @@ -76,8 +76,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterPressureSensor.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterRainSensor/README.md b/libraries/Matter/examples/MatterRainSensor/README.md index 1e81b3ea3c9..12d6228cf07 100644 --- a/libraries/Matter/examples/MatterRainSensor/README.md +++ b/libraries/Matter/examples/MatterRainSensor/README.md @@ -78,8 +78,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterRainSensor.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterSimpleWidowsBlind/MatterSimpleWidowsBlind.ino b/libraries/Matter/examples/MatterSimpleBlinds/MatterSimpleBlinds.ino similarity index 90% rename from libraries/Matter/examples/MatterSimpleWidowsBlind/MatterSimpleWidowsBlind.ino rename to libraries/Matter/examples/MatterSimpleBlinds/MatterSimpleBlinds.ino index 51c4192d7f2..a2f21d1e9aa 100644 --- a/libraries/Matter/examples/MatterSimpleWidowsBlind/MatterSimpleWidowsBlind.ino +++ b/libraries/Matter/examples/MatterSimpleBlinds/MatterSimpleBlinds.ino @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Matter Simple Window Blinds Example +// Matter Simple Blinds Example // This is a minimal example that only controls Lift percentage using a single onGoToLiftPercentage() callback #include @@ -33,7 +33,7 @@ const char *password = "your-password"; // Change this to your WiFi password #endif // Simple callback - handles window Lift change request -bool onBlindLift(uint8_t liftPercent) { +bool onBlindsLift(uint8_t liftPercent) { // This example only uses lift Serial.printf("Window Covering change request: Lift=%d%%\r\n", liftPercent); @@ -44,9 +44,9 @@ bool onBlindLift(uint8_t liftPercent) { void setup() { Serial.begin(115200); delay(1000); - Serial.println("\n========================================"); - Serial.println("Matter Simple Window Blinds Example"); - Serial.println("========================================\n"); + Serial.println("\n============================"); + Serial.println("Matter Simple Blinds Example"); + Serial.println("============================\n"); // CONFIG_ENABLE_CHIPOBLE is enabled when BLE is used to commission the Matter Network #if !CONFIG_ENABLE_CHIPOBLE @@ -70,7 +70,7 @@ void setup() { WindowBlinds.begin(100, 0, MatterWindowCovering::ROLLERSHADE); // Set up the onGoToLiftPercentage callback - this handles all window covering changes requested by the Matter Controller - WindowBlinds.onGoToLiftPercentage(onBlindLift); + WindowBlinds.onGoToLiftPercentage(onBlindsLift); // Start Matter Matter.begin(); diff --git a/libraries/Matter/examples/MatterSimpleWidowsBlind/README.md b/libraries/Matter/examples/MatterSimpleBlinds/README.md similarity index 84% rename from libraries/Matter/examples/MatterSimpleWidowsBlind/README.md rename to libraries/Matter/examples/MatterSimpleBlinds/README.md index 637d2a4b398..f029b4e314e 100644 --- a/libraries/Matter/examples/MatterSimpleWidowsBlind/README.md +++ b/libraries/Matter/examples/MatterSimpleBlinds/README.md @@ -1,4 +1,4 @@ -# Matter Simple Window Blinds Example +# Matter Simple Blinds Example This is a minimal example demonstrating how to create a Matter-compatible window covering device with lift control only. This example uses a single `onGoToLiftPercentage()` callback to handle all window covering lift changes, making it ideal for simple implementations. @@ -53,12 +53,21 @@ Before uploading the sketch, configure the following: const char *password = "your-password"; ``` +## Building and Flashing + +1. Open the `MatterSimpleBlinds.ino` sketch in the Arduino IDE. +2. Select your ESP32 board from the **Tools > Board** menu. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. + ## Expected Output ``` -======================================== -Matter Simple Window Blinds Example -======================================== +============================ +Matter Simple Blinds Example +============================ Connecting to your-ssid WiFi connected @@ -87,7 +96,7 @@ Window Covering change request: Lift=50% ## Code Structure -- **`onBlindLift()`**: Callback function that handles window covering lift changes. This is registered with `WindowBlinds.onGoToLiftPercentage()` and is triggered when `TargetPositionLiftPercent100ths` changes. The callback receives the target lift percentage (0-100%). +- **`onBlindsLift()`**: Callback function that handles window covering lift changes. This is registered with `WindowBlinds.onGoToLiftPercentage()` and is triggered when `TargetPositionLiftPercent100ths` changes. The callback receives the target lift percentage (0-100%). - **`setup()`**: Initializes Wi-Fi (if needed), Window Covering endpoint with `ROLLERSHADE` type, registers the callback, and starts Matter. - **`loop()`**: Empty - all control is handled via Matter callbacks. @@ -95,10 +104,10 @@ Window Covering change request: Lift=50% ### Adding Motor Control -In the `onBlindLift()` callback, replace the simulation code with actual motor control: +In the `onBlindsLift()` callback, replace the simulation code with actual motor control: ```cpp -bool onBlindLift(uint8_t liftPercent) { +bool onBlindsLift(uint8_t liftPercent) { Serial.printf("Moving window covering to %d%%\r\n", liftPercent); // Here you would control your actual motor/actuator @@ -122,7 +131,7 @@ bool onBlindLift(uint8_t liftPercent) { 3. **Commands not working**: Ensure the callback returns `true` to accept the command. If it returns `false`, the command will be rejected. -4. **Motor not responding**: Replace the simulation code in `onBlindLift()` with your actual motor control implementation. Remember to update `CurrentPosition` and set `OperationalState` to `STALL` when movement is complete. +4. **Motor not responding**: Replace the simulation code in `onBlindsLift()` with your actual motor control implementation. Remember to update `CurrentPosition` and set `OperationalState` to `STALL` when movement is complete. ## Notes diff --git a/libraries/Matter/examples/MatterSimpleWidowsBlind/ci.yml b/libraries/Matter/examples/MatterSimpleBlinds/ci.yml similarity index 100% rename from libraries/Matter/examples/MatterSimpleWidowsBlind/ci.yml rename to libraries/Matter/examples/MatterSimpleBlinds/ci.yml diff --git a/libraries/Matter/examples/MatterSmartButton/README.md b/libraries/Matter/examples/MatterSmartButton/README.md index e7290ba40b3..08aa6ee35f5 100644 --- a/libraries/Matter/examples/MatterSmartButton/README.md +++ b/libraries/Matter/examples/MatterSmartButton/README.md @@ -71,8 +71,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterSmartButton.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterStatus/MatterStatus.ino b/libraries/Matter/examples/MatterStatus/MatterStatus.ino new file mode 100644 index 00000000000..ffbb5fa6212 --- /dev/null +++ b/libraries/Matter/examples/MatterStatus/MatterStatus.ino @@ -0,0 +1,119 @@ +// Copyright 2025 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Matter Status Example +// This example demonstrates how to check enabled Matter features and connectivity status +// It implements a basic on/off light and reports capability and connection status + +#include +// CONFIG_ENABLE_CHIPOBLE is enabled when BLE is used to commission the Matter Network +#if !CONFIG_ENABLE_CHIPOBLE // ESP32 and ESP32-S2 do not support BLE commissioning +// if the device can be commissioned using BLE, WiFi is not used - save flash space +#include +// WiFi is manually set and started +const char *ssid = "your-ssid"; // Change this to your WiFi SSID +const char *password = "your-password"; // Change this to your WiFi password +#endif + +// List of Matter Endpoints for this Node +// On/Off Light Endpoint +MatterOnOffLight OnOffLight; + +// set your board LED pin here +#ifdef LED_BUILTIN +const uint8_t ledPin = LED_BUILTIN; +#else +const uint8_t ledPin = 2; // Set your pin here if your board has not defined LED_BUILTIN +#warning "Do not forget to set the LED pin" +#endif + +// Matter Protocol Endpoint Callback +bool setLightOnOff(bool state) { + Serial.printf("User Callback :: New Light State = %s\r\n", state ? "ON" : "OFF"); + if (state) { + digitalWrite(ledPin, HIGH); + } else { + digitalWrite(ledPin, LOW); + } + // This callback must return the success state to Matter core + return true; +} + +void setup() { + // Initialize the LED (light) GPIO + pinMode(ledPin, OUTPUT); + digitalWrite(ledPin, LOW); // Start with light OFF + + Serial.begin(115200); + delay(1000); + Serial.println("\n========================================"); + Serial.println("Matter Status Example"); + Serial.println("========================================\n"); + + // Report enabled features + Serial.println("=== Enabled Features ==="); + Serial.printf("WiFi Station Enabled: %s\r\n", Matter.isWiFiStationEnabled() ? "YES" : "NO"); + Serial.printf("WiFi Access Point Enabled: %s\r\n", Matter.isWiFiAccessPointEnabled() ? "YES" : "NO"); + Serial.printf("Thread Enabled: %s\r\n", Matter.isThreadEnabled() ? "YES" : "NO"); + Serial.printf("BLE Commissioning Enabled: %s\r\n", Matter.isBLECommissioningEnabled() ? "YES" : "NO"); + Serial.println(); + +// CONFIG_ENABLE_CHIPOBLE is enabled when BLE is used to commission the Matter Network +#if !CONFIG_ENABLE_CHIPOBLE + // We start by connecting to a WiFi network + if (Matter.isWiFiStationEnabled()) { + Serial.print("Connecting to "); + Serial.println(ssid); + WiFi.mode(WIFI_STA); + WiFi.begin(ssid, password); + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + Serial.println(""); + Serial.println("WiFi connected"); + Serial.print("IP address: "); + Serial.println(WiFi.localIP()); + } +#endif + + // Initialize On/Off Light endpoint + OnOffLight.begin(false); // Start with light OFF + OnOffLight.onChange(setLightOnOff); + + // Start Matter + Matter.begin(); + Serial.println("Matter started"); + Serial.println(); + + // Print commissioning information + Serial.println("========================================"); + Serial.println("Matter Node is not commissioned yet."); + Serial.println("Initiate the device discovery in your Matter environment."); + Serial.println("Commission it to your Matter hub with the manual pairing code or QR code"); + Serial.printf("Manual pairing code: %s\r\n", Matter.getManualPairingCode().c_str()); + Serial.printf("QR code URL: %s\r\n", Matter.getOnboardingQRCodeUrl().c_str()); + Serial.println("========================================\n"); +} + +void loop() { + // Report connection status every 10 seconds + Serial.println("=== Connection Status ==="); + Serial.printf("WiFi Connected: %s\r\n", Matter.isWiFiConnected() ? "YES" : "NO"); + Serial.printf("Thread Connected: %s\r\n", Matter.isThreadConnected() ? "YES" : "NO"); + Serial.printf("Device Connected: %s\r\n", Matter.isDeviceConnected() ? "YES" : "NO"); + Serial.printf("Device Commissioned: %s\r\n", Matter.isDeviceCommissioned() ? "YES" : "NO"); + Serial.println(); + delay(10000); +} diff --git a/libraries/Matter/examples/MatterStatus/README.md b/libraries/Matter/examples/MatterStatus/README.md new file mode 100644 index 00000000000..f4ccf49060e --- /dev/null +++ b/libraries/Matter/examples/MatterStatus/README.md @@ -0,0 +1,202 @@ +# Matter Status Example + +This example demonstrates how to check enabled Matter features and connectivity status using the Matter library's capability query functions. It implements a basic on/off light device and periodically reports the status of enabled features and network connections. + +## Supported Targets + +| SoC | Wi-Fi | Thread | BLE Commissioning | LED | Status | +| --- | ---- | ------ | ----------------- | --- | ------ | +| ESP32 | ✅ | ❌ | ❌ | Required | Fully supported | +| ESP32-S2 | ✅ | ❌ | ❌ | Required | Fully supported | +| ESP32-S3 | ✅ | ❌ | ✅ | Required | Fully supported | +| ESP32-C3 | ✅ | ❌ | ✅ | Required | Fully supported | +| ESP32-C5 | ✅ | ❌ | ✅ | Required | Fully supported | +| ESP32-C6 | ✅ | ❌ | ✅ | Required | Fully supported | +| ESP32-H2 | ❌ | ✅ | ✅ | Required | Supported (Thread only) | + +### Note on Commissioning: + +- **ESP32 & ESP32-S2** do not support commissioning over Bluetooth LE. For these chips, you must provide Wi-Fi credentials directly in the sketch code so they can connect to your network manually. +- **ESP32-C6** Although it has Thread support, the ESP32 Arduino Matter Library has been precompiled using Wi-Fi only. In order to configure it for Thread-only operation it is necessary to build the project as an ESP-IDF component and to disable the Matter Wi-Fi station feature. +- **ESP32-C5** Although it has Thread support, the ESP32 Arduino Matter Library has been precompiled using Wi-Fi only. In order to configure it for Thread-only operation it is necessary to build the project as an ESP-IDF component and to disable the Matter Wi-Fi station feature. + +## Features + +- Matter protocol implementation for an on/off light device +- **Capability reporting**: Checks and reports enabled Matter features at startup + - `isWiFiStationEnabled()`: Checks if WiFi Station mode is supported and enabled + - `isWiFiAccessPointEnabled()`: Checks if WiFi AP mode is supported and enabled + - `isThreadEnabled()`: Checks if Thread network is supported and enabled + - `isBLECommissioningEnabled()`: Checks if BLE commissioning is supported and enabled +- **Connection status monitoring**: Reports connection status every 10 seconds + - `isWiFiConnected()`: Checks WiFi connection status (if WiFi Station is enabled) + - `isThreadConnected()`: Checks Thread connection status (if Thread is enabled) + - `isDeviceConnected()`: Checks overall device connectivity (WiFi or Thread) + - `isDeviceCommissioned()`: Checks if the device is commissioned to a Matter fabric +- Simple on/off light control +- Matter commissioning via QR code or manual pairing code +- Integration with Apple HomeKit, Amazon Alexa, and Google Home + +## Hardware Requirements + +- ESP32 compatible development board (see supported targets table) +- LED connected to GPIO pin (or using built-in LED) for visual feedback + +## Pin Configuration + +- **LED**: Uses `LED_BUILTIN` if defined, otherwise pin 2 + +## Software Setup + +### Prerequisites + +1. Install the Arduino IDE (2.0 or newer recommended) +2. Install ESP32 Arduino Core with Matter support +3. ESP32 Arduino libraries: + - `Matter` + - `Wi-Fi` (only for ESP32 and ESP32-S2) + +### Configuration + +Before uploading the sketch, configure the following: + +1. **Wi-Fi Credentials** (for ESP32 and ESP32-S2 only): + ```cpp + const char *ssid = "your-ssid"; + const char *password = "your-password"; + ``` + +2. **LED pin configuration** (if not using built-in LED): + ```cpp + const uint8_t ledPin = 2; // Set your LED pin here + ``` + +## Building and Flashing + +1. Open the `MatterStatus.ino` sketch in the Arduino IDE. +2. Select your ESP32 board from the **Tools > Board** menu. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. + +## Expected Output + +Once the sketch is running, open the Serial Monitor at a baud rate of **115200**. You should see output similar to the following: + +``` +======================================== +Matter Status Example +======================================== + +=== Enabled Features === +WiFi Station Enabled: YES +WiFi Access Point Enabled: NO +Thread Enabled: NO +BLE Commissioning Enabled: NO + +Connecting to your-ssid +....... +WiFi connected +IP address: 192.168.1.100 +Matter started + +======================================== +Matter Node is not commissioned yet. +Initiate the device discovery in your Matter environment. +Commission it to your Matter hub with the manual pairing code or QR code +Manual pairing code: 34970112332 +QR code URL: https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT:Y.K9042C00KA0648G00 +======================================== + +=== Connection Status === +WiFi Connected: YES +Thread Connected: NO +Device Connected: YES +Device Commissioned: NO + +=== Connection Status === +WiFi Connected: YES +Thread Connected: NO +Device Connected: YES +Device Commissioned: NO + +... (reports every 10 seconds) + +User Callback :: New Light State = ON +=== Connection Status === +WiFi Connected: YES +Thread Connected: NO +Device Connected: YES +Device Commissioned: YES + +... (reports every 10 seconds) +``` + +## Usage + +### Capability Queries + +The example demonstrates the use of capability query functions that check both hardware support (SOC capabilities) and Matter configuration: + +- **`Matter.isWiFiStationEnabled()`**: Returns `true` if the device supports WiFi Station mode and it's enabled in Matter configuration +- **`Matter.isWiFiAccessPointEnabled()`**: Returns `true` if the device supports WiFi AP mode and it's enabled in Matter configuration +- **`Matter.isThreadEnabled()`**: Returns `true` if the device supports Thread networking and it's enabled in Matter configuration +- **`Matter.isBLECommissioningEnabled()`**: Returns `true` if the device supports BLE and BLE commissioning is enabled + +These functions are useful for: +- Determining which features are available on the current device +- Adapting application behavior based on available capabilities +- Debugging configuration issues + +### Connection Status Monitoring + +The example periodically reports connection status every 10 seconds: + +- **`Matter.isWiFiConnected()`**: Returns `true` if WiFi Station is connected. If WiFi Station is not enabled, always returns `false`. +- **`Matter.isThreadConnected()`**: Returns `true` if Thread is attached to a network. If Thread is not enabled, always returns `false`. +- **`Matter.isDeviceConnected()`**: Returns `true` if the device is connected via WiFi or Thread (overall connectivity status) +- **`Matter.isDeviceCommissioned()`**: Returns `true` if the device has been commissioned to a Matter fabric + +### Smart Home Integration + +Use a Matter-compatible hub (like an Apple HomePod, Google Nest Hub, or Amazon Echo) to commission the device. Once commissioned, you can control the light from your smart home app. + +## Code Structure + +- **`setup()`**: + - Initializes hardware (LED) + - Reports enabled features using capability query functions + - Connects to WiFi (if needed and enabled) + - Initializes On/Off Light endpoint + - Starts Matter stack + - Prints commissioning information + +- **`loop()`**: + - Reports connection status every 10 seconds + - All light control is handled via Matter callbacks + +- **Callbacks**: + - `setLightOnOff()`: Controls the physical LED based on the on/off state and prints the state change to Serial Monitor + +## Troubleshooting + +1. **Device not discoverable**: Ensure Wi-Fi is connected (for ESP32/ESP32-S2) or BLE is enabled (for other chips). + +2. **Capability queries return unexpected values**: These functions check both hardware support and Matter configuration. Verify that the features are enabled in your Matter build configuration. + +3. **Connection status not updating**: The status is reported every 10 seconds. Check Serial Monitor output to see the periodic reports. + +4. **LED not responding**: Verify pin configurations and connections. + +5. **Failed to commission**: Try factory resetting the device by calling `Matter.decommission()`. Other option would be to erase the SoC Flash Memory by using `Arduino IDE Menu` -> `Tools` -> `Erase All Flash Before Sketch Upload: "Enabled"` or directly with `esptool.py --port erase_flash` + +## Related Documentation + +- [Matter Overview](https://docs.espressif.com/projects/arduino-esp32/en/latest/matter/matter.html) +- [Matter Endpoint Base Class](https://docs.espressif.com/projects/arduino-esp32/en/latest/matter/matter_ep.html) +- [Matter On/Off Light Endpoint](https://docs.espressif.com/projects/arduino-esp32/en/latest/matter/ep_on_off_light.html) + +## License + +This example is licensed under the Apache License, Version 2.0. diff --git a/libraries/Matter/examples/MatterStatus/ci.yml b/libraries/Matter/examples/MatterStatus/ci.yml new file mode 100644 index 00000000000..050a80ff543 --- /dev/null +++ b/libraries/Matter/examples/MatterStatus/ci.yml @@ -0,0 +1,4 @@ +fqbn_append: PartitionScheme=huge_app + +requires: + - CONFIG_ESP_MATTER_ENABLE_DATA_MODEL=y diff --git a/libraries/Matter/examples/MatterTemperatureControlledCabinet/README.md b/libraries/Matter/examples/MatterTemperatureControlledCabinet/README.md index 8ed6c69454a..be60edb6ceb 100644 --- a/libraries/Matter/examples/MatterTemperatureControlledCabinet/README.md +++ b/libraries/Matter/examples/MatterTemperatureControlledCabinet/README.md @@ -86,8 +86,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterTemperatureControlledCabinet.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterTemperatureControlledCabinetLevels/README.md b/libraries/Matter/examples/MatterTemperatureControlledCabinetLevels/README.md index 88f74a634bd..626d85aaddb 100644 --- a/libraries/Matter/examples/MatterTemperatureControlledCabinetLevels/README.md +++ b/libraries/Matter/examples/MatterTemperatureControlledCabinetLevels/README.md @@ -87,8 +87,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterTemperatureControlledCabinetLevels.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterTemperatureLight/README.md b/libraries/Matter/examples/MatterTemperatureLight/README.md index 4eb9432400b..264f9136b2c 100644 --- a/libraries/Matter/examples/MatterTemperatureLight/README.md +++ b/libraries/Matter/examples/MatterTemperatureLight/README.md @@ -82,8 +82,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterTemperatureLight.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterTemperatureSensor/README.md b/libraries/Matter/examples/MatterTemperatureSensor/README.md index 9a494aec932..696b61168ea 100644 --- a/libraries/Matter/examples/MatterTemperatureSensor/README.md +++ b/libraries/Matter/examples/MatterTemperatureSensor/README.md @@ -76,8 +76,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterTemperatureSensor.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterThermostat/README.md b/libraries/Matter/examples/MatterThermostat/README.md index 2a87f4d93af..6a567da0690 100644 --- a/libraries/Matter/examples/MatterThermostat/README.md +++ b/libraries/Matter/examples/MatterThermostat/README.md @@ -78,8 +78,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterThermostat.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterWaterFreezeDetector/README.md b/libraries/Matter/examples/MatterWaterFreezeDetector/README.md index 0701a5af979..f2783df8476 100644 --- a/libraries/Matter/examples/MatterWaterFreezeDetector/README.md +++ b/libraries/Matter/examples/MatterWaterFreezeDetector/README.md @@ -78,8 +78,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterWaterFreezeDetector.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterWaterLeakDetector/README.md b/libraries/Matter/examples/MatterWaterLeakDetector/README.md index 3dcf2f2e9f7..ae7d44d29df 100644 --- a/libraries/Matter/examples/MatterWaterLeakDetector/README.md +++ b/libraries/Matter/examples/MatterWaterLeakDetector/README.md @@ -78,8 +78,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterWaterLeakDetector.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/examples/MatterWindowCovering/README.md b/libraries/Matter/examples/MatterWindowCovering/README.md index 8e18539c65a..f802f3d0cc1 100644 --- a/libraries/Matter/examples/MatterWindowCovering/README.md +++ b/libraries/Matter/examples/MatterWindowCovering/README.md @@ -82,8 +82,10 @@ Before uploading the sketch, configure the following: 1. Open the `MatterWindowCovering.ino` sketch in the Arduino IDE. 2. Select your ESP32 board from the **Tools > Board** menu. -3. Connect your ESP32 board to your computer via USB. -4. Click the **Upload** button to compile and flash the sketch. +3. Select **"Huge APP (3MB No OTA/1MB SPIFFS)"** from **Tools > Partition Scheme** menu. +4. Enable **"Erase All Flash Before Sketch Upload"** option from **Tools** menu. +5. Connect your ESP32 board to your computer via USB. +6. Click the **Upload** button to compile and flash the sketch. ## Expected Output diff --git a/libraries/Matter/keywords.txt b/libraries/Matter/keywords.txt index 4baaf54f17f..9d1d44f5e04 100644 --- a/libraries/Matter/keywords.txt +++ b/libraries/Matter/keywords.txt @@ -63,10 +63,14 @@ begin KEYWORD2 end KEYWORD2 getManualPairingCode KEYWORD2 getOnboardingQRCodeUrl KEYWORD2 +isBLECommissioningEnabled KEYWORD2 isDeviceCommissioned KEYWORD2 -isWiFiConnected KEYWORD2 -isThreadConnected KEYWORD2 isDeviceConnected KEYWORD2 +isThreadConnected KEYWORD2 +isThreadEnabled KEYWORD2 +isWiFiAccessPointEnabled KEYWORD2 +isWiFiConnected KEYWORD2 +isWiFiStationEnabled KEYWORD2 decommission KEYWORD2 attributeChangeCB KEYWORD2 setOnOff KEYWORD2 diff --git a/libraries/Matter/src/Matter.cpp b/libraries/Matter/src/Matter.cpp index 5ddacc1622c..151a9e8990e 100644 --- a/libraries/Matter/src/Matter.cpp +++ b/libraries/Matter/src/Matter.cpp @@ -175,31 +175,70 @@ void ArduinoMatter::begin() { } } -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD -bool ArduinoMatter::isThreadConnected() { - return false; // Thread Network TBD +// Network and Commissioning Capability Queries +bool ArduinoMatter::isWiFiStationEnabled() { + // Check hardware support (SOC capabilities) AND Matter configuration +#ifdef SOC_WIFI_SUPPORTED +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION + return true; +#else + return false; +#endif +#else + return false; +#endif +} + +bool ArduinoMatter::isWiFiAccessPointEnabled() { + // Check hardware support (SOC capabilities) AND Matter configuration +#ifdef SOC_WIFI_SUPPORTED +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP + return true; +#else + return false; +#endif +#else + return false; +#endif +} + +bool ArduinoMatter::isThreadEnabled() { + // Check Matter configuration only +#if CONFIG_ENABLE_MATTER_OVER_THREAD || CHIP_DEVICE_CONFIG_ENABLE_THREAD + return true; +#else + return false; +#endif } + +bool ArduinoMatter::isBLECommissioningEnabled() { + // Check hardware support (SOC capabilities) AND Matter/ESP configuration + // BLE commissioning requires: SOC BLE support AND (CHIPoBLE or NimBLE enabled) +#ifdef SOC_BLE_SUPPORTED +#if CONFIG_ENABLE_CHIPOBLE + return true; +#else + return false; +#endif +#else + return false; #endif +} bool ArduinoMatter::isDeviceCommissioned() { return chip::Server::GetInstance().GetFabricTable().FabricCount() > 0; } -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION bool ArduinoMatter::isWiFiConnected() { return chip::DeviceLayer::ConnectivityMgr().IsWiFiStationConnected(); } -#endif + +bool ArduinoMatter::isThreadConnected() { + return chip::DeviceLayer::ConnectivityMgr().IsThreadAttached(); +} bool ArduinoMatter::isDeviceConnected() { - bool retCode = false; -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD - retCode |= ArduinoMatter::isThreadConnected(); -#endif -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION - retCode |= ArduinoMatter::isWiFiConnected(); -#endif - return retCode; + return ArduinoMatter::isWiFiConnected() || ArduinoMatter::isThreadConnected(); } void ArduinoMatter::decommission() { diff --git a/libraries/Matter/src/Matter.h b/libraries/Matter/src/Matter.h index 73b3b35de62..dc72017a7d3 100644 --- a/libraries/Matter/src/Matter.h +++ b/libraries/Matter/src/Matter.h @@ -179,13 +179,17 @@ class ArduinoMatter { return String("https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT:Y.K9042C00KA0648G00"); } static void begin(); + + // Network and Commissioning Capability Queries + // These methods check both hardware support (SOC capabilities) and Matter configuration + static bool isWiFiStationEnabled(); // Check if WiFi Station mode is supported and enabled + static bool isWiFiAccessPointEnabled(); // Check if WiFi AP mode is supported and enabled + static bool isThreadEnabled(); // Check if Thread network is supported and enabled + static bool isBLECommissioningEnabled(); // Check if BLE commissioning is supported and enabled + static bool isDeviceCommissioned(); -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION static bool isWiFiConnected(); -#endif -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD static bool isThreadConnected(); -#endif static bool isDeviceConnected(); static void decommission();