Applied fixes to be compliant with scenes test plan (#29598)
diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp
index 28f7c16..c7e376a 100644
--- a/src/app/clusters/level-control/level-control.cpp
+++ b/src/app/clusters/level-control/level-control.cpp
@@ -419,14 +419,6 @@
updateCoupledColorTemp(endpoint);
-#ifdef EMBER_AF_PLUGIN_SCENES
- // The level has changed, so the scene is no longer valid.
- if (emberAfContainsServer(endpoint, Scenes::Id))
- {
- Scenes::ScenesServer::Instance().MakeSceneInvalid(endpoint);
- }
-#endif // EMBER_AF_PLUGIN_SCENES
-
// Are we at the requested level?
if (currentLevel.Value() == state->moveToLevel)
{
@@ -918,6 +910,14 @@
state->callbackSchedule.runTime = System::Clock::Milliseconds32(0);
+#ifdef EMBER_AF_PLUGIN_SCENES
+ // The level has changed, the scene is no longer valid.
+ if (emberAfContainsServer(endpoint, Scenes::Id))
+ {
+ Scenes::ScenesServer::Instance().MakeSceneInvalid(endpoint);
+ }
+#endif // EMBER_AF_PLUGIN_SCENES
+
// The setup was successful, so mark the new state as active and return.
scheduleTimerCallbackMs(endpoint, computeCallbackWaitTimeMs(state->callbackSchedule, state->eventDurationMs));
diff --git a/src/app/clusters/scenes-server/SceneTableImpl.cpp b/src/app/clusters/scenes-server/SceneTableImpl.cpp
index 70ad7ab..ea894c9 100644
--- a/src/app/clusters/scenes-server/SceneTableImpl.cpp
+++ b/src/app/clusters/scenes-server/SceneTableImpl.cpp
@@ -767,7 +767,9 @@
FabricSceneData fabric(mEndpointId, fabric_index, mMaxScenesPerFabric, mMaxScenesPerEndpoint);
SceneTableData scene(mEndpointId, fabric_index);
- ReturnErrorOnFailure(fabric.Load(mStorage));
+ CHIP_ERROR err = fabric.Load(mStorage);
+ VerifyOrReturnValue(CHIP_ERROR_NOT_FOUND != err, CHIP_NO_ERROR);
+ ReturnErrorOnFailure(err);
for (uint16_t i = 0; i < mMaxScenesPerFabric; i++)
{
diff --git a/src/app/clusters/scenes-server/scenes-server.cpp b/src/app/clusters/scenes-server/scenes-server.cpp
index 9fe8763..92eb472 100644
--- a/src/app/clusters/scenes-server/scenes-server.cpp
+++ b/src/app/clusters/scenes-server/scenes-server.cpp
@@ -718,11 +718,15 @@
if (CHIP_NO_ERROR == err)
{
status = Attributes::SceneValid::Set(ctx.mRequestPath.mEndpointId, true);
- if (EMBER_ZCL_STATUS_SUCCESS != status)
- {
- ctx.mCommandHandler.AddStatus(ctx.mRequestPath, ToInteractionModelStatus(status));
- return;
- }
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, ToInteractionModelStatus(status));
+ return;
+ }
+
+ if (CHIP_ERROR_NOT_FOUND == err)
+ {
+ // TODO : implement proper mapping between CHIP_ERROR and IM Status
+ ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Protocols::InteractionModel::Status::NotFound);
+ return;
}
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, StatusIB(err).mStatus);