- Notifications
You must be signed in to change notification settings - Fork7.8k
-
Hello to everyone! Is it possible to run Matter Over Thread no WiFi in Arduno IDE? #defineCONFIG_ENABLE_CHIPOBLE1 #defineCHIP_DEVICE_CONFIG_ENABLE_THREAD1#defineCHIP_DEVICE_CONFIG_ENABLE_WIFI0 #include<Matter.h>#include<Preferences.h>#include<platform/CHIPDeviceLayer.h>#include<platform/ConnectivityManager.h>usingnamespacechip::DeviceLayer;#include"esp_mac.h"// Matter endpoint: On/Off LightMatterOnOffLight OnOffLight;Preferences matterPref;#ifndef LED_BUILTIN#defineLED_BUILTIN2#endifconstuint8_t ledPin = LED_BUILTIN;constuint8_t buttonPin = BOOT_PIN;// BOOTconstchar *nsName ="MatterPrefs";constchar *onOffKey ="OnOff";uint32_t btn_ts =0;bool btn_down =false;constuint32_t debounceMs =250;constuint32_t decommissionHoldMs =5000;boolsetLightOnOff(bool state) {digitalWrite(ledPin, state ? HIGH : LOW); matterPref.putBool(onOffKey, state);returntrue;}voidprintMacs() {uint8_t mac[6];esp_read_mac(mac, ESP_MAC_WIFI_STA); Serial.printf("WiFi STA MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);esp_read_mac(mac, ESP_MAC_WIFI_SOFTAP); Serial.printf("WiFi AP MAC: %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);}voidsetup() { Serial.begin(115200);pinMode(ledPin, OUTPUT);pinMode(buttonPin, INPUT_PULLUP);ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Disabled);ConnectivityMgr().ClearWiFiStationProvision();printMacs(); matterPref.begin(nsName,false);bool last = matterPref.getBool(onOffKey,true); OnOffLight.begin(last); OnOffLight.onChange(setLightOnOff); Matter.begin();if (!Matter.isDeviceCommissioned()) { Serial.println("\n=== Matter over Thread (BLE commissioning) ==="); Serial.printf("Manual pairing code: %s\n", Matter.getManualPairingCode().c_str()); Serial.printf("QR code URL: %s\n", Matter.getOnboardingQRCodeUrl().c_str()); }else { Serial.printf("Resumed. Initial state: %s\n", OnOffLight.getOnOff() ?"ON" :"OFF"); OnOffLight.updateAccessory(); }}voidloop() {staticuint32_t lastNote =0;if (!Matter.isDeviceCommissioned() &&millis() - lastNote >5000) { Serial.println("Waiting for commissioning…"); lastNote =millis(); }if (digitalRead(buttonPin) == LOW && !btn_down) { btn_down =true; btn_ts =millis(); }uint32_t dt =millis() - btn_ts;if (btn_down && dt > debounceMs &&digitalRead(buttonPin) == HIGH) { btn_down =false; OnOffLight.toggle(); }if (btn_down && dt > decommissionHoldMs) { Serial.println("Decommissioning…"); OnOffLight.setOnOff(false); Matter.decommission(); btn_ts =millis(); }} |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 5 comments
-
@SuGlider PTAL |
BetaWas this translation helpful?Give feedback.
All reactions
-
ESP32-C6: OpenThread init fails in Arduino Core 3.3.0 (IDF 5.5) due to missing eventfd/select in core build Repro (ESP32-C6, Arduino Core 3.3.0 / IDF 5.5):
Runtime: Hypothesis / root cause: Request: Notes:
|
BetaWas this translation helpful?Give feedback.
All reactions
-
ESP-Matter code will select the Netowrk in a specific order: WiFi -> Thread -> ETH. It is possible to create a C6 Matter Application using Arduino Matter API + Thread using Arduino as IDF Component. |
BetaWas this translation helpful?Give feedback.
All reactions
-
This is how Matter over Thread shall be bulit using the ESP32-C6: 1- Install IDF 5.5.0 into your computer. It can be done following the guide inhttps://docs.espressif.com/projects/esp-idf/en/stable/esp32c6/get-started/index.html For Windows:https://docs.espressif.com/projects/esp-idf/en/stable/esp32c6/get-started/index.html 2- Test IDF with idf.py --version to check if it is installed and configured correctly. It shall output 3- Clone the repository with the Arduino as IDF Component project. 4- Open an IDF terminal and execute idf.py set-target esp32c6 5- Execute idf.py -p <your COM or /dev/tty port connected to the ESP32-C6> flash monitor 6- It will build, upload and show the UART0 output in the screen. 7- Try to add the Matter RGB light to your Matter environment. |
BetaWas this translation helpful?Give feedback.
All reactions
-
For the records, there is a Matter over Thread example for C6/C5/H2 in |
BetaWas this translation helpful?Give feedback.