From 836390ed636ca36126dbcbe763d0f127626cba8d Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Thu, 2 Feb 2023 11:17:47 -0500 Subject: [PATCH] Fix MoveToLevelWithOnOff to only set the SceneGlobalControl to true if it produced a On value. Also we were not checking the featuremap of the right cluster (#24800) --- src/app/clusters/level-control/level-control.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index c97fad07a2fae3..497d3cb718f085 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -761,15 +761,14 @@ static EmberAfStatus moveToLevelHandler(EndpointId endpoint, CommandId commandId schedule(endpoint, computeCallbackWaitTimeMs(state->callbackSchedule, state->eventDurationMs)); status = EMBER_ZCL_STATUS_SUCCESS; - if (commandId == Commands::MoveToLevelWithOnOff::Id) +#ifdef EMBER_AF_PLUGIN_ON_OFF + // Check that the received MoveToLevelWithOnOff produces a On action and that the onoff support the lighting featuremap + if (commandId == Commands::MoveToLevelWithOnOff::Id && state->moveToLevel != state->minLevel && + OnOffServer::Instance().SupportsLightingApplications(endpoint)) { - uint32_t featureMap; - if (Attributes::FeatureMap::Get(endpoint, &featureMap) == EMBER_ZCL_STATUS_SUCCESS && - READBITS(featureMap, EMBER_AF_LEVEL_CONTROL_FEATURE_LIGHTING)) - { - OnOff::Attributes::GlobalSceneControl::Set(endpoint, true); - } + OnOff::Attributes::GlobalSceneControl::Set(endpoint, true); } +#endif // EMBER_AF_PLUGIN_ON_OFF return status; }