From 8b508ba143a155abb9b8e33701b56960a72313eb Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 23 Jul 2024 19:11:54 -0400 Subject: [PATCH] Made onoff and scenes behaviors independant in scenes interaction --- .../clusters/level-control/level-control.cpp | 5 +- .../clusters/on-off-server/on-off-server.cpp | 15 +-- .../suites/certification/Test_TC_OO_2_7.yaml | 99 ++++--------------- 3 files changed, 20 insertions(+), 99 deletions(-) diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index 6ae7d141a4edfe..8e133efebf533c 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -250,10 +250,7 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl if (!app::NumericAttributeTraits::IsNullValue(level)) { - CommandId command = LevelControlHasFeature(endpoint, LevelControl::Feature::kOnOff) ? Commands::MoveToLevelWithOnOff::Id - : Commands::MoveToLevel::Id; - - moveToLevelHandler(endpoint, command, level, app::DataModel::MakeNullable(static_cast(timeMs / 100)), + moveToLevelHandler(endpoint, Commands::MoveToLevel::Id, level, app::DataModel::MakeNullable(static_cast(timeMs / 100)), chip::Optional>(), chip::Optional>(), INVALID_STORED_LEVEL); } diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 8332403d68ebd4..5d03de43ad194c 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -207,19 +207,8 @@ class DefaultOnOffSceneHandler : public scenes::DefaultSceneHandlerImpl return err; } - // This handler assumes it is being used with the default handler for the level control. Therefore if the level control - // cluster with on off feature is present on the endpoint and the level control handler is registered, it assumes this - // handler will take action on the on-off state. This assumes the level control attributes were also saved in the scene. - // This is to prevent a behavior where the on off state is set by this handler, and then the level control handler or vice - // versa. -#ifdef MATTER_DM_PLUGIN_LEVEL_CONTROL - if (!(LevelControlWithOnOffFeaturePresent(endpoint) && - ScenesManagement::ScenesServer::Instance().IsHandlerRegistered(endpoint, LevelControlServer::GetSceneHandler()))) -#endif - { - VerifyOrReturnError(mTransitionTimeInterface.sceneEventControl(endpoint) != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - OnOffServer::Instance().scheduleTimerCallbackMs(mTransitionTimeInterface.sceneEventControl(endpoint), timeMs); - } + VerifyOrReturnError(mTransitionTimeInterface.sceneEventControl(endpoint) != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + OnOffServer::Instance().scheduleTimerCallbackMs(mTransitionTimeInterface.sceneEventControl(endpoint), timeMs); return CHIP_NO_ERROR; } diff --git a/src/app/tests/suites/certification/Test_TC_OO_2_7.yaml b/src/app/tests/suites/certification/Test_TC_OO_2_7.yaml index 952c08717706d5..01ca578c651048 100644 --- a/src/app/tests/suites/certification/Test_TC_OO_2_7.yaml +++ b/src/app/tests/suites/certification/Test_TC_OO_2_7.yaml @@ -123,26 +123,23 @@ tests: value: [] - label: "Step 2a: TH sends Off command to DUT" - PICS: "!LVL.S.C04.Rsp" cluster: "On/Off" command: "Off" - - label: - "Step 2a: TH sends a MoveToLevelWithOnOff command to DUT, with Level - =0 and TransitionTime =0 (immediate)" - PICS: LVL.S.C04.Rsp - cluster: "Level Control" - command: "MoveToLevelWithOnOff" + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" arguments: values: - - name: "Level" - value: 0 - - name: "TransitionTime" - value: 0 - - name: "OptionsMask" - value: 0 - - name: "OptionsOverride" - value: 0 + - name: "ms" + value: 1000 + + - label: "Step 2b: after a few seconds, TH reads OnOff attribute from DUT" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 - label: "Step 2b: TH sends a StoreScene command to DUT with the GroupID field @@ -169,9 +166,6 @@ tests: AttributeValueList: [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }]}]' " command: "AddScene" - ## The default handlers for level control and on/off assume that if both clusters are in the same endpoint, - ## the level control cluster will use the onoff with level command and thus onoff will be turned on. - PICS: LVL.S.C04.Rsp arguments: values: - name: "GroupID" @@ -189,12 +183,7 @@ tests: ClusterID: 0x0006, AttributeValueList: [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], - }, - { - ClusterID: 0x0008, - AttributeValueList: - [{ AttributeID: 0x0000, ValueUnsigned8: 0xFE }], - }, + } ] response: values: @@ -205,62 +194,8 @@ tests: - name: "SceneID" value: 0x02 - - label: "Step 3: TH sends a AddScene command to DUT with the GroupID field - set to G1, the SceneID field set to 0x02, the TransitionTime field set - to 1000 (1s) and the ExtensionFieldSets set to: '[{ ClusterID: 0x0006, - AttributeValueList: [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }]}]' - " - command: "AddScene" - PICS: "!LVL.S.C04.Rsp" - arguments: - values: - - name: "GroupID" - value: G1 - - name: "SceneID" - value: 0x02 - - name: "TransitionTime" - value: 1000 - - name: "SceneName" - value: "Scene1" - - name: "ExtensionFieldSets" - value: - [ - { - ClusterID: 0x0006, - AttributeValueList: - [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }], - }, - ] - response: - values: - - name: "Status" - value: 0x00 - - name: "GroupID" - value: G1 - - name: "SceneID" - value: 0x02 - - - label: "Step 4a: TH sends Off command to DUT" - cluster: "On/Off" - command: "Off" - - - label: "Wait 1000ms" - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 1000 - - - label: "Step 4b: after a few seconds, TH reads OnOff attribute from DUT" - cluster: "On/Off" - command: "readAttribute" - attribute: "OnOff" - response: - value: 0 - - label: - "Step 5a: TH sends a RecallScene command to DUT with the GroupID field + "Step 4a: TH sends a RecallScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x02." PICS: S.S.C05.Rsp command: "RecallScene" @@ -279,7 +214,7 @@ tests: - name: "ms" value: 2000 - - label: "Step 5b: after a few seconds, TH reads OnOff attribute from DUT" + - label: "Step 4b: after a few seconds, TH reads OnOff attribute from DUT" cluster: "On/Off" command: "readAttribute" attribute: "OnOff" @@ -287,7 +222,7 @@ tests: value: 1 - label: - "Step 6a: TH sends a RecallScene command to DUT with the GroupID field + "Step 5a: TH sends a RecallScene command to DUT with the GroupID field set to G1 and the SceneID field set to 0x01." PICS: S.S.C05.Rsp command: "RecallScene" @@ -306,7 +241,7 @@ tests: - name: "ms" value: 1000 - - label: "Step 6b: after a few seconds, TH reads OnOff attribute from DUT" + - label: "Step 5b: after a few seconds, TH reads OnOff attribute from DUT" cluster: "On/Off" command: "readAttribute" attribute: "OnOff"