Skip to content

[BUG] SetActivePreset does not trigger a subscription report for ActivePresetHandle attribute #43582

@lboue

Description

@lboue

Summary

When a Matter controller sends a SetActivePresetRequest command to a thermostat, the ActivePresetHandle attribute is correctly updated on the device side (confirmed via a subsequent read), but no subscription report is sent to notify subscribers of the change. This means controllers relying on subscriptions (such as python-matter-server / Home Assistant) never learn about the new value unless they explicitly poll the attribute.

Root cause

In thermostat-server-presets.cpp, SetActivePreset() calls delegate->SetActivePresetHandle() but does not call MatterReportingAttributeChangeCallback afterwards to mark the attribute as dirty:

Status ThermostatAttrAccess::SetActivePreset(EndpointId endpoint, DataModel::Nullable<ByteSpan> presetHandle)
{
    // ...
    CHIP_ERROR err = delegate->SetActivePresetHandle(presetHandle);

    if (err != CHIP_NO_ERROR)
    {
        ChipLogError(Zcl, "Failed to set ActivePresetHandle with error %" CHIP_ERROR_FORMAT, err.Format());
        return StatusIB(err).mStatus;
    }

    return Status::Success;
    // ← MatterReportingAttributeChangeCallback(..., ActivePresetHandle::Id) is missing here
}

Expected behavior

After a successful SetActivePresetHandle, the framework should be notified that ActivePresetHandle has changed, so that all active subscriptions receive a Report Data message with the new value.

Proposed fix

Add a call to MatterReportingAttributeChangeCallback after the delegate call succeeds:

    CHIP_ERROR err = delegate->SetActivePresetHandle(presetHandle);

    if (err != CHIP_NO_ERROR)
    {
        ChipLogError(Zcl, "Failed to set ActivePresetHandle with error %" CHIP_ERROR_FORMAT, err.Format());
        return StatusIB(err).mStatus;
    }

    MatterReportingAttributeChangeCallback(endpoint, Thermostat::Id, ActivePresetHandle::Id);

    return Status::Success;
  1. Commission a thermostat supporting the Presets feature (e.g. Eve Thermo, or the Linux thermostat example)
  2. Subscribe to ActivePresetHandle (attribute 0x004E, cluster 0x0201)
  3. Send SetActivePresetRequest with a valid preset handle
  4. Observe: no subscription report is received, even after several minutes
  5. Send a read active-preset-handle → the new value is returned correctly

Impact

Any Matter controller using subscriptions (the standard approach) will never receive the updated ActivePresetHandle value after a SetActivePresetRequest. Workarounds such as optimistic local state updates are required on the controller side to maintain a consistent UI.

Confirmed against: Linux thermostat example (examples/thermostat/linux) and Eve Thermo hardware.

Bug prevalence

always

GitHub hash of the SDK that was being used

fa956ce

Platform

linux

Platform Version(s)

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions