From 25e922d5185d91a6c8383b529a8209ac0c77b9c7 Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs <112982107+lpbeliveau-silabs@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:17:54 -0500 Subject: [PATCH] [LevelControl] Level Control Recall null level behavior (#30554) * Fixed behavior of the RecallScene for the Default scene handler in the level control cluster * Added explicit check for null value instead of relying on movetoLevel --- src/app/clusters/level-control/level-control.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index f12b20684f7b6d..ad394d1fc248b3 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -238,17 +238,15 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl // TODO : Implement action on frequency when frequency not provisional anymore // if(LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)){} - Status status; - CommandId command = LevelControlHasFeature(endpoint, LevelControl::Feature::kOnOff) ? Commands::MoveToLevelWithOnOff::Id - : Commands::MoveToLevel::Id; - status = moveToLevelHandler(endpoint, command, level, app::DataModel::MakeNullable(static_cast(timeMs / 100)), - chip::Optional>(), chip::Optional>(), - INVALID_STORED_LEVEL); - - if (status != Status::Success) + if (!chip::app::NumericAttributeTraits::IsNullValue(level)) { - return CHIP_ERROR_READ_FAILED; + CommandId command = LevelControlHasFeature(endpoint, LevelControl::Feature::kOnOff) ? Commands::MoveToLevelWithOnOff::Id + : Commands::MoveToLevel::Id; + + moveToLevelHandler(endpoint, command, level, app::DataModel::MakeNullable(static_cast(timeMs / 100)), + chip::Optional>(), chip::Optional>(), + INVALID_STORED_LEVEL); } return CHIP_NO_ERROR;