Skip to content

Commit

Permalink
[LevelControl] Level Control Recall null level behavior (#30554)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lpbeliveau-silabs authored and pull[bot] committed Mar 26, 2024
1 parent c6f0520 commit 1295144
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>(timeMs / 100)),
chip::Optional<BitMask<OptionsBitmap>>(), chip::Optional<BitMask<OptionsBitmap>>(),
INVALID_STORED_LEVEL);

if (status != Status::Success)
if (!chip::app::NumericAttributeTraits<uint8_t>::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<uint16_t>(timeMs / 100)),
chip::Optional<BitMask<OptionsBitmap>>(), chip::Optional<BitMask<OptionsBitmap>>(),
INVALID_STORED_LEVEL);
}

return CHIP_NO_ERROR;
Expand Down

0 comments on commit 1295144

Please sign in to comment.