From 102715482d4726a0f7dae5f6dd72ac7694519c42 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Wed, 8 Nov 2023 15:01:10 -0500 Subject: [PATCH] [Scenes] make LastConfiguredBy optional (#30308) * Unsupported Attribute in UpdateLastConfiguredBy no longer causes commands to fail * Update src/app/clusters/scenes-server/scenes-server.cpp Co-authored-by: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> --------- Co-authored-by: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> --- src/app/clusters/scenes-server/scenes-server.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp index 08f92596757309..0bb0e012ba0f94 100644 --- a/src/app/clusters/scenes-server/scenes-server.cpp +++ b/src/app/clusters/scenes-server/scenes-server.cpp @@ -80,17 +80,20 @@ template CHIP_ERROR UpdateLastConfiguredBy(HandlerContext & ctx, ResponseType resp) { Access::SubjectDescriptor descriptor = ctx.mCommandHandler.GetSubjectDescriptor(); + EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS; + if (AuthMode::kCase == descriptor.authMode) { - ReturnErrorOnFailure( - AddResponseOnError(ctx, resp, Attributes::LastConfiguredBy::Set(ctx.mRequestPath.mEndpointId, descriptor.subject))); + status = Attributes::LastConfiguredBy::Set(ctx.mRequestPath.mEndpointId, descriptor.subject); } else { - ReturnErrorOnFailure(AddResponseOnError(ctx, resp, Attributes::LastConfiguredBy::SetNull(ctx.mRequestPath.mEndpointId))); + status = Attributes::LastConfiguredBy::SetNull(ctx.mRequestPath.mEndpointId); } - return CHIP_NO_ERROR; + // LastConfiguredBy is optional, so we don't want to fail the command if it fails to update + VerifyOrReturnValue(!(EMBER_ZCL_STATUS_SUCCESS == status || EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE == status), CHIP_NO_ERROR); + return AddResponseOnError(ctx, resp, status); } ScenesServer ScenesServer::mInstance;