Skip to content

ESP32 Matter Arduino not resuming session #11378

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
1 task done
theonlytechnohead opened this issue May 20, 2025 · 4 comments
Open
1 task done

ESP32 Matter Arduino not resuming session #11378

theonlytechnohead opened this issue May 20, 2025 · 4 comments
Assignees
Labels
Area: Matter Issues and Feature Request about Matter Protocol Status: Awaiting triage Issue is waiting for triage

Comments

@theonlytechnohead
Copy link

Board

ESP32 Dev Module

Device Description

Plain module connected with jumpers

Hardware Configuration

GPIO 12 & 13 are connected to LED strips with 60 SK6812 LEDs per strip
LEDs are powered externally

Version

v3.2.0

IDE Name

Arduino IDE

Operating System

Windows 10

Flash frequency

80 MHz

PSRAM enabled

no

Upload speed

921600

Description

Hello,
Thank you for such an excellent experience setting up a Matter device!
I followed the ColorLight example to get started, however when the device reboots, I see some errors in the console.
The errors seem to appear roughly when Matter.begin() or ColorLight.updateAccessory() is called.

The device also produces errors when responding to some commands sent by routines in the Google Home app:
(317140) chip[DMG]: Endpoint=1 Cluster=0x0000_0300 Command=0x0000_000A status 0x81 (no additional context)
The Google Home app reports that an action failed.

Please let me know if there's anything else I can do to help debug these issues!

Sketch

#include <Matter.h>
#include <WiFi.h>

const char *ssid = "ssid ";
const char *password = "password ";

MatterColorLight ColorLight;

#include <FastLED.h>

#define LEFT_PIN 12
#define RIGHT_PIN 13

#define NUM_LEDS 60

CRGB left[NUM_LEDS];
CRGB right[NUM_LEDS];

TaskHandle_t matterTask;

bool state = true;
espHsvColor_t colour = { 0, 0, 0 };
espHsvColor_t target = { 140, 254, 127 };

void setup() {
  Serial.begin(115200);

  FastLED.addLeds<WS2812, LEFT_PIN, GRB>(left, NUM_LEDS).setRgbw(RgbwDefault());
  FastLED.addLeds<WS2812, RIGHT_PIN, GRB>(right, NUM_LEDS).setRgbw(RgbwDefault());

  // clear to black
  set_all(CRGB::Black);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    centre_wipe(CRGB::Yellow);
    delay(500);
    centre_wipe(CRGB::Black);
  }

  ColorLight.begin(state, target);

  ColorLight.onChange(update);

  xTaskCreatePinnedToCore(
    matter,        // Function to implement the task
    "matterTask",  // Name of the task
    8192,          // Stack size in words (causes stack overflow (DUH!!!!) if too low
    NULL,          // Task input parameter
    0,             // Priority of the task, 0 is lowest
    &matterTask,   // Task handle
    0);            // Core where the task should run, code runs on core 1 by default
}

void matter(void *parameter) {
  Matter.begin();
  vTaskDelay(500);
  // this may be a restart of an already commissioned Matter accessory
  if (Matter.isDeviceCommissioned()) {
    while (!Matter.isDeviceConnected()) {
      vTaskDelay(500);
      centre_wipe(CRGB::Orange);
      vTaskDelay(500);
      centre_wipe(CRGB::Black);
    }
    // configure the light based on initial state and colour
    ColorLight.updateAccessory();
  }

  for (;;) {
    vTaskDelay(10);
    if (!Matter.isDeviceCommissioned()) {
      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());
      // wait for Matter Light Commissioning.
      uint32_t timeCount = 0;
      while (!Matter.isDeviceCommissioned()) {
        while (WiFi.status() != WL_CONNECTED) {
          vTaskDelay(500);
          centre_wipe(CRGB::Yellow);
          vTaskDelay(500);
          centre_wipe(CRGB::Black);
        }
        vTaskDelay(500);
        centre_wipe(CRGB::Blue);
        vTaskDelay(500);
        centre_wipe(CRGB::Black);
        if ((timeCount++ % 50) == 0) {  // 50*100ms = 5 sec
          Serial.println("Matter Node not commissioned yet. Waiting for commissioning.");
          Serial.printf("Manual pairing code: %s\r\n", Matter.getManualPairingCode().c_str());
          Serial.printf("QR code URL: %s\r\n", Matter.getOnboardingQRCodeUrl().c_str());
        }
      }
    }
  }
}

void loop() {
  if (colour.h != target.h || colour.s != target.s || colour.v != target.v) {
    colour = { target.h, target.s, target.v };
    set_all(CHSV(colour.h, colour.s, colour.v));
    Serial.printf("loop colour changed to hsv(%d, %d, %d)\n", colour.h, colour.s, colour.v);
  }
}

bool update(bool s, espHsvColor_t c) {
  if (state != s) {
    Serial.printf("update state changed to %s\n", s ? "ON" : "OFF");
    state = s;
    if (state && 1 < c.v)
      target = { c.h, c.s, c.v };
    if (!state) {
      target = { 0, 0, 0 };
    }
    return true;
  }
  if (colour.h != c.h || colour.s != c.s || colour.v != c.v) {
    Serial.printf("update colour changed to hsv(%d, %d, %d)\n", c.h, c.s, c.v);
    if (state && 1 < c.v)
      target = { c.h, c.s, c.v };
    else
      target = { 0, 0, 0 };
    return true;
  }
  // This callback must return the success state to Matter
  return true;
}

void set_all(CRGB c) {
  for (int i = 0; i < NUM_LEDS; i++) {
    left[i] = c;
    right[i] = c;
  }
  FastLED.show();
}

void centre_wipe(CRGB c) {
  for (int i = 0; i < NUM_LEDS; i++) {
    left[i] = c;
    right[i] = c;
    FastLED.show();
  }
}

Debug Message

E (11114) chip[DMG]: Endpoint 0, Cluster 0x0000_0031 not found in IncreaseClusterDataVersion!
E (11115) chip[DMG]: Endpoint 0, Cluster 0x0000_0031 not found in IncreaseClusterDataVersion!
update color changed to hsl(0, 0, 0)
E (12611) chip[IN]: SendMessage() to UDP:[REDACTED-IPV6-ADDRESS]:5540 failed: 3000004
E (12612) chip[-]: Error LwIP:0x03000004 at ./managed_components/espressif__esp_matter/connectedhomeip/connectedhomeip/src/app/OperationalSessionSetup.cpp:254
E (12623) chip[DMG]: Failed to establish CASE for subscription-resumption with error '3000004'
E (12648) chip[DMG]: Failed to establish CASE for subscription-resumption with error '3000004'

Other Steps to Reproduce

The device is provisioned within Google Home via a Google Nest Mini

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@theonlytechnohead theonlytechnohead added the Status: Awaiting triage Issue is waiting for triage label May 20, 2025
@SuGlider SuGlider self-assigned this May 20, 2025
@SuGlider SuGlider added the Area: Matter Issues and Feature Request about Matter Protocol label May 20, 2025
@SuGlider
Copy link
Collaborator

Endpoint=1 Cluster=0x0000_0300 Command=0x0000_000 is about the MatterColorLight Endpoint.
Cluster 0x0300 is ColorControl Cluster for Color Setting, suported by Google controller.
Command 0x0000 is MoveToHue command.
Status 0x81 is CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER.

It was supposed to work fine.
Could you please set Debug Level to Verbose and report the log when the Google Routine tries to chane the light color?

@SuGlider
Copy link
Collaborator

When the device reboots, it may take some time to restabish the CASE session with the Google Matter Controller.

E (11114) chip[DMG]: Endpoint 0, Cluster 0x0000_0031 not found in IncreaseClusterDataVersion!
E (11115) chip[DMG]: Endpoint 0, Cluster 0x0000_0031 not found in IncreaseClusterDataVersion!
update color changed to hsl(0, 0, 0)
E (12611) chip[IN]: SendMessage() to UDP:[REDACTED-IPV6-ADDRESS]:5540 failed: 3000004
E (12612) chip[-]: Error LwIP:0x03000004 at ./managed_components/espressif__esp_matter/connectedhomeip/connectedhomeip/src/app/OperationalSessionSetup.cpp:254
E (12623) chip[DMG]: Failed to establish CASE for subscription-resumption with error '3000004'
E (12648) chip[DMG]: Failed to establish CASE for subscription-resumption with error '3000004'

It shall work after a couple minutes in the worst case.
If possible, reboot the ESP32 and wait for about 5 minutes.
In case it doesn't recover, please report the DEBUG logs for investigation.

@SuGlider
Copy link
Collaborator

Google Controller seems to demand some updating. Please make sure that the Google Device has its firmware in the latest version.

@Veletax
Copy link

Veletax commented May 24, 2025

Same issue and error message in my case with ESP32- C6 Dev Module with the example MatterColorLigth (using RGB in-builtin LED) and using Home Assistant. It seems error is not related to the hub.

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: Awaiting triage Issue is waiting for triage
Projects
None yet
Development

No branches or pull requests

3 participants