Skip to content

Thermostat: implement SetpointChange tracking attributes (0x0030–0x0032) #72792

Description

@lboue

Summary

The Thermostat cluster server does not update the three SetpointChange tracking attributes when a setpoint write occurs:

Attribute ID Type
SetpointChangeSource 0x0030 SetpointChangeSourceEnum
SetpointChangeAmount 0x0031 int16s (nullable)
SetpointChangeSourceTimestamp 0x0032 epoch_s

According to the Matter specification (section 4.3.9), these attributes shall be updated whenever OccupiedHeatingSetpoint, OccupiedCoolingSetpoint, UnoccupiedHeatingSetpoint, or UnoccupiedCoolingSetpoint is written.

Expected behavior

After a write to one of the four setpoint attributes:

  • SetpointChangeAmount is set to new_value − previous_value.
  • SetpointChangeSourceTimestamp is set to the current CHIP epoch time.
  • SetpointChangeSource reflects who triggered the change:
    • Manual (default) when no delegate override is present.
    • Schedule or External when the application delegate signals so.

Proposed solution

  1. Add a GetSetpointChangeSource() virtual method to ThermostatDelegate (default returns Manual) so applications can report the source.
  2. Save the pre-change value in MatterThermostatClusterServerPreAttributeChangedCallback (if validation succeeds).
  3. In MatterThermostatClusterServerAttributeChangedCallback, compute and write the three attributes using the saved value.
  4. Enable the three attributes (RAM storage) in the thermostat example ZAP configuration and regenerate the .matter file.

Related PR

A first implementation of this feature was proposed in #43643, but the thermostat cluster server has since been refactored (split into ThermostatCluster.cpp, ThermostatClusterPresets.cpp, etc.), so a fresh port is needed.

Testing

  • Verify attributes are updated after a write to OccupiedCoolingSetpoint or OccupiedHeatingSetpoint.
  • Verify SetpointChangeAmount reflects the correct delta (new − previous value).
  • Verify SetpointChangeSourceTimestamp is set to the current CHIP epoch time.
  • Verify SetpointChangeSource defaults to Manual when no delegate is set.
  • Verify a custom delegate can override GetSetpointChangeSource().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions