Skip to content

Commit 7ee42b1

Browse files
Added check on out of range values in the level control handler
1 parent 56e4d3c commit 7ee42b1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/app/clusters/level-control/level-control.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl
242242
// TODO : Implement action on frequency when frequency not provisional anymore
243243
// if(LevelControlHasFeature(endpoint, LevelControl::Feature::kFrequency)){}
244244

245+
EmberAfLevelControlState * state = getState(endpoint);
246+
if (level < state->minLevel || level > state->maxLevel)
247+
{
248+
chip::app::NumericAttributeTraits<uint8_t>::SetNull(level);
249+
}
250+
245251
if (!app::NumericAttributeTraits<uint8_t>::IsNullValue(level))
246252
{
247253
CommandId command = LevelControlHasFeature(endpoint, LevelControl::Feature::kOnOff) ? Commands::MoveToLevelWithOnOff::Id

0 commit comments

Comments
 (0)