Skip to content

Commit

Permalink
[Scenes] make LastConfiguredBy optional (#30308)
Browse files Browse the repository at this point in the history
* Unsupported Attribute in UpdateLastConfiguredBy no longer causes commands to fail

* Update src/app/clusters/scenes-server/scenes-server.cpp

Co-authored-by: mkardous-silabs <[email protected]>

---------

Co-authored-by: mkardous-silabs <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jan 9, 2024
1 parent 00161d8 commit 2109602
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/clusters/scenes-server/scenes-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,20 @@ template <typename ResponseType>
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;
Expand Down

0 comments on commit 2109602

Please sign in to comment.