@@ -171,9 +171,16 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl
171
171
uint8_t maxLevel;
172
172
VerifyOrReturnError (EMBER_ZCL_STATUS_SUCCESS == Attributes::MaxLevel::Get (endpoint, &maxLevel), CHIP_ERROR_READ_FAILED);
173
173
174
- pairs[0 ].attributeID = Attributes::CurrentLevel::Id;
175
- pairs[0 ].attributeValue = (!level.IsNull ()) ? level.Value () : maxLevel + 1 ;
176
- size_t attributeCount = 1 ;
174
+ pairs[0 ].attributeID = Attributes::CurrentLevel::Id;
175
+ if (!level.IsNull ())
176
+ {
177
+ pairs[0 ].attributeValue = level.Value ();
178
+ }
179
+ else
180
+ {
181
+ chip::app::NumericAttributeTraits<uint32_t >::SetNull (pairs[0 ].attributeValue );
182
+ }
183
+ size_t attributeCount = 1 ;
177
184
if (LevelControlHasFeature (endpoint, LevelControl::Feature::kFrequency ))
178
185
{
179
186
uint16_t frequency;
@@ -238,9 +245,9 @@ class DefaultLevelControlSceneHandler : public scenes::DefaultSceneHandlerImpl
238
245
CommandId command = LevelControlHasFeature (endpoint, LevelControl::Feature::kOnOff ) ? Commands::MoveToLevelWithOnOff::Id
239
246
: Commands::MoveToLevel::Id;
240
247
241
- status = moveToLevelHandler (
242
- endpoint, command, level, app::DataModel::MakeNullable< uint16_t >( static_cast < uint16_t >(timeMs / 100 ) ),
243
- chip::Optional<BitMask<LevelControlOptions>>(), chip::Optional<BitMask<LevelControlOptions>>(), INVALID_STORED_LEVEL);
248
+ status = moveToLevelHandler (endpoint, command, level, app::DataModel::MakeNullable ( static_cast < uint16_t >(timeMs / 100 )),
249
+ chip::Optional<BitMask<LevelControlOptions>>(), chip::Optional<BitMask<LevelControlOptions>>( ),
250
+ INVALID_STORED_LEVEL);
244
251
245
252
if (status != Status::Success)
246
253
{
0 commit comments