diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index a2bfc1a58b794e..18127420bb0431 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;