-
When I work with the light example, I see that the BootReason attribute for the General Diagnostics cluster is null. How can I get a proper value into this attribute? |
Beta Was this translation helpful? Give feedback.
Answered by
olavt
Apr 1, 2025
Replies: 1 comment
-
This seems to work: static uint8_t GetMatterBootReason() {
esp_reset_reason_t reason = esp_reset_reason();
switch (reason) {
case ESP_RST_POWERON:
return 0x00; // PowerOnReset
case ESP_RST_SW:
return 0x03; // SoftwareReset
case ESP_RST_INT_WDT:
case ESP_RST_TASK_WDT:
case ESP_RST_WDT:
return 0x04; // WatchdogReset
case ESP_RST_BROWNOUT:
return 0x02; // BrownoutReset
case ESP_RST_PANIC:
return 0x05; // CrashReset
case ESP_RST_EXT:
default:
return 0xFF; // Unknown (Matter allows vendor-specific values >= 0x80)
}
}
void ConfigureGeneralDiagnosticsCluster(endpoint_t* endpoint)
{
cluster_t *cluster = cluster::get(endpoint, GeneralDiagnostics::Id);
uint8_t bootReason = GetMatterBootReason();
cluster::general_diagnostics::attribute::create_boot_reason(cluster, bootReason);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
olavt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to work: