Issues related to Matter over Thread product interfaces for reporting brightness changes to the APP

We are developing a light product that features a built-in button. A single click of this button toggles the light on/off, while a long press adjusts the brightness level.

If we manually adjust the brightness and then report the new brightness level via the Clusters::LevelControl::Attributes::CurrentLevel::Set() interface, this action triggers the MatterPostAttributeChangeCallback() command to set the brightness (which involves receiving commands for the transition from the current value to the target value).

Since our intent is solely to report the new brightness to the app without triggering a control command, this creates a conflict.

Is there an interface that allows us to only report the brightness state without subsequently receiving a dimming/setting command?

  • Do you know the differences between these API interfaces? Is there any interface that can meet my needs?

  • Hi,

    The functions differ in what value they set and whether they mark the attribute as "dirty", i.e. needing to be reported/updated.

    Set(EndpointId endpoint, uint8_t value);

    This sets the attribute to a specific non-null uint8_t value.

    Set(EndpointId endpoint, uint8_t value, MarkAttributeDirty markDirty);

    This is the same as above, but allows you to specify whether to mark the attribute as dirty. "Dirty" in this context means the attribute has changed and the system should notify/report this change. 

    The default is MarkAttributeDirty::kIfChanged, which means that the system is only notified if the attribute value is changed. This is the behavior when using Set() without dirty. When using the variant of the function that includes markDirty, you can suppress or force reporting even if the value changed or did not change, by setting markDirty to kNo or kYes.

    SetNull(EndpointId endpoint);

    Sets the attribute to a "null" value.

    SetNull(EndpointId endpoint, MarkAttributeDirty markDirty);

    Same as SetNull(), but you can mark the attribute as dirty.

    Set(EndpointId endpoint, const chip::app::DataModel::Nullable<uint8_t> & value);

    Sets the attribute to either a specific value or null depending on the Nullable wrapper. So, while the first Set() function handles the case where the attribute is a specific value and SetNull() handles when it is null, this function can handle both those cases. It is a more generic function and is useful in situations where you might want to handle both cases with a single call, especially if the value comes from a source that may or may not be null (e.g. user input).

    Set(EndpointId endpoint, const chip::app::DataModel::Nullable<uint8_t> & value, MarkAttributeDirty markDirty);

    Same above, but you can mark the attribute as dirty.

    Best regards,
    Marte

Related