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
lpbeliveau-silabs and mkardous-silabs authored Nov 8, 2023
1 parent 1813bfa commit eec1318
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 eec1318

Please sign in to comment.