Skip to content

[Code Driven Cluster] temperature measurement cluster#43204

Open
arielsz71 wants to merge 16 commits intoproject-chip:masterfrom
arielsz71:43113_decouple_temperature_measurement
Open

[Code Driven Cluster] temperature measurement cluster#43204
arielsz71 wants to merge 16 commits intoproject-chip:masterfrom
arielsz71:43113_decouple_temperature_measurement

Conversation

@arielsz71
Copy link
Contributor

@arielsz71 arielsz71 commented Feb 18, 2026

Summary

Decoupling temperature measurement cluster (code driven cluster implementation)

Related issues

Fixes #43113

Testing

Tested using chip-all-clusters-app and matter-repl.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request decouples the Temperature Measurement cluster by migrating it to a code-driven implementation. The changes are extensive, touching many example applications to adopt the new API for setting temperature values. New cluster implementation files, tests, and build configurations have been added. The overall approach is solid and the implementation appears correct and consistent across the codebase. I have one suggestion to improve the formatting of the new README file for better readability.

Comment on lines +1 to +24
# This cluster is currently following a code driven approach.

# This means that the Accessors for the attribute MeasuredValue are no longer available.

# Now to set the value for this attribute the following code change applies:

# BEFORE (using the Accessors)

app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Set(1, value);

# CURRENT (using the code driven approach)

auto temperatureMeasurement = app::Clusters::TemperatureMeasurement::FindClusterOnEndpoint(1);
VerifyOrReturn(temperatureMeasurement != nullptr);

CHIP_ERROR err = temperatureMeasurement->SetMeasuredValue(value);
if (err == CHIP_NO_ERROR)
{
// SetMeasuredValue() succeeded
}
else
{
// SetMeasuredValue() failed
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The markdown formatting in this file seems incorrect. Each line starting with a # will render as a top-level heading, which is likely not the intended formatting. I've suggested a change to use proper markdown for headers, paragraphs, and fenced code blocks to improve readability.

This cluster is currently following a code driven approach.

This means that the Accessors for the attribute `MeasuredValue` are no longer available.

Now to set the value for this attribute the following code change applies:

### BEFORE (using the Accessors)

```cpp
    app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Set(1, value);

CURRENT (using the code driven approach)

    auto temperatureMeasurement = app::Clusters::TemperatureMeasurement::FindClusterOnEndpoint(1);
    VerifyOrReturn(temperatureMeasurement != nullptr);

    CHIP_ERROR err = temperatureMeasurement->SetMeasuredValue(value);
    if (err == CHIP_NO_ERROR)
    {
        // SetMeasuredValue() succeeded
    }
    else
    {
        // SetMeasuredValue() failed
    }

@mergify mergify bot removed the conflict label Feb 18, 2026
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

PR #43204: Size comparison from 3ba5c51 to 173848d

Full report (20 builds for cc13x4_26x4, cc32xx, efr32, nrfconnect, nxp, psoc6, qpg, realtek, stm32)
platform target config section 3ba5c51 173848d change % change
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777436 777436 0 0.0
RAM 103280 103280 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786000 786000 0 0.0
RAM 108496 108496 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 731068 731152 84 0.0
RAM 97260 97300 40 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 715596 715596 0 0.0
RAM 97460 97460 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 556508 557624 1116 0.2
RAM 204448 204488 40 0.0
lock CC3235SF_LAUNCHXL FLASH 590704 590704 0 0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 969152 969144 -8 -0.0
RAM 125476 125476 0 0.0
BRD4338a FLASH 757708 757700 -8 -0.0
RAM 237712 237712 0 0.0
window-app BRD4187C FLASH 1066872 1066864 -8 -0.0
RAM 126700 126700 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 955936 956044 108 0.0
RAM 162081 162121 40 0.0
nxp contact mcxw71+release FLASH 746432 746432 0 0.0
RAM 66912 66912 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1701804 1701948 144 0.0
RAM 213852 213892 40 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1602924 1603036 112 0.0
RAM 210740 210780 40 0.0
light cy8ckit_062s2_43012 FLASH 1468652 1468652 0 0.0
RAM 196936 196936 0 0.0
lock cy8ckit_062s2_43012 FLASH 1496788 1496788 0 0.0
RAM 224720 224720 0 0.0
qpg lighting-app qpg6200+debug FLASH 840292 840292 0 0.0
RAM 127764 127764 0 0.0
lock-app qpg6200+debug FLASH 778904 778904 0 0.0
RAM 118712 118712 0 0.0
realtek light-switch-app rtl8777g FLASH 704952 704952 0 0.0
RAM 113440 113440 0 0.0
lighting-app rtl8777g FLASH 750648 750648 0 0.0
RAM 114640 114640 0 0.0
stm32 light STM32WB5MM-DK FLASH 477256 477256 0 0.0
RAM 141280 141280 0 0.0


// update the temp attribute here for hardcoded endpoint 1
chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Set(1, static_cast<int16_t>(n * 100));
TEMPORARY_RETURN_IGNORED temperatureMeasurement->SetMeasuredValue(static_cast<int16_t>(n * 100));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe LogErrorOnFailure instead of temporary ignored? I would avoid adding new TEMPORARY_RETURN_IGNORED for new code.

@github-actions
Copy link

github-actions bot commented Feb 18, 2026

PR #43204: Size comparison from c1553ce to 6b7957d

Full report (31 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section c1553ce 6b7957d change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1108172 1108172 0 0.0
RAM 178674 178674 0 0.0
bl702 lighting-app bl702+eth FLASH 663248 663248 0 0.0
RAM 134689 134689 0 0.0
bl702+wifi FLASH 838954 838954 0 0.0
RAM 124213 124213 0 0.0
bl706+mfd+rpc+littlefs FLASH 1073182 1073182 0 0.0
RAM 117157 117157 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 905796 905796 0 0.0
RAM 105748 105748 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 986248 986248 0 0.0
RAM 109644 109644 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777468 777468 0 0.0
RAM 103280 103280 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786000 786000 0 0.0
RAM 108496 108496 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 731068 732272 1204 0.2
RAM 97260 97316 56 0.1
pump-controller-app LP_EM_CC1354P10_6 FLASH 715596 715596 0 0.0
RAM 97460 97460 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 556508 557536 1028 0.2
RAM 204448 204496 48 0.0
lock CC3235SF_LAUNCHXL FLASH 590704 590704 0 0.0
RAM 204744 204744 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 955936 957308 1372 0.1
RAM 162081 162127 46 0.0
nxp contact mcxw71+release FLASH 746432 746432 0 0.0
RAM 66912 66912 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1701804 1703420 1616 0.1
RAM 213852 213900 48 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1602924 1604524 1600 0.1
RAM 210740 210780 40 0.0
light cy8ckit_062s2_43012 FLASH 1468652 1468652 0 0.0
RAM 196936 196936 0 0.0
lock cy8ckit_062s2_43012 FLASH 1496788 1496788 0 0.0
RAM 224720 224720 0 0.0
qpg lighting-app qpg6200+debug FLASH 840292 840292 0 0.0
RAM 127764 127764 0 0.0
lock-app qpg6200+debug FLASH 778904 778904 0 0.0
RAM 118712 118712 0 0.0
realtek light-switch-app rtl8777g FLASH 704952 704952 0 0.0
RAM 113440 113440 0 0.0
lighting-app rtl8777g FLASH 750672 750672 0 0.0
RAM 114640 114640 0 0.0
stm32 light STM32WB5MM-DK FLASH 477280 477280 0 0.0
RAM 141280 141280 0 0.0
telink bridge-app tl7218x FLASH 714884 716156 1272 0.2
RAM 93564 93616 52 0.1
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 840238 840238 0 0.0
RAM 42856 42856 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 827830 827830 0 0.0
RAM 97312 97312 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 720662 720662 0 0.0
RAM 54800 54800 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 783726 783726 0 0.0
RAM 74504 74504 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 725086 725086 0 0.0
RAM 33212 33212 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 613776 613776 0 0.0
RAM 118192 118192 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 829136 829140 4 0.0
RAM 95092 95092 0 0.0

@arielsz71 arielsz71 changed the title Decouple temperature measurement cluster [Code Driven Cluster] temperature measurement cluster Feb 18, 2026
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

PR #43204: Size comparison from c1553ce to 934d157

Increases above 0.2%:

platform target config section c1553ce 934d157 change % change
telink bridge-app tl7218x FLASH 714884 727816 12932 1.8
RAM 93564 95756 2192 2.3
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 840238 851362 11124 1.3
RAM 42856 44148 1292 3.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 720662 725062 4400 0.6
RAM 54800 55728 928 1.7
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 783726 787688 3962 0.5
RAM 74504 74912 408 0.5
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 829136 841616 12480 1.5
RAM 95092 97240 2148 2.3
Full report (33 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section c1553ce 934d157 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1108172 1108158 -14 -0.0
RAM 178674 178674 0 0.0
bl702 lighting-app bl702+eth FLASH 663248 663234 -14 -0.0
RAM 134689 134689 0 0.0
bl702+wifi FLASH 838954 838940 -14 -0.0
RAM 124213 124213 0 0.0
bl706+mfd+rpc+littlefs FLASH 1073182 1073168 -14 -0.0
RAM 117157 117157 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 905796 905782 -14 -0.0
RAM 105748 105748 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 986248 986234 -14 -0.0
RAM 109644 109644 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777468 777636 168 0.0
RAM 103280 103280 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786000 785984 -16 -0.0
RAM 108496 108496 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 731068 732256 1188 0.2
RAM 97260 97308 48 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 715596 715580 -16 -0.0
RAM 97460 97460 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 556508 557880 1372 0.2
RAM 204448 204488 40 0.0
lock CC3235SF_LAUNCHXL FLASH 590704 590688 -16 -0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 969152 969144 -8 -0.0
RAM 125476 125476 0 0.0
BRD4338a FLASH 757708 757684 -24 -0.0
RAM 237712 237712 0 0.0
window-app BRD4187C FLASH 1066872 1066832 -40 -0.0
RAM 126700 126700 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 955936 957288 1352 0.1
RAM 162081 162123 42 0.0
nxp contact mcxw71+release FLASH 746432 746416 -16 -0.0
RAM 66912 66912 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1701804 1703404 1600 0.1
RAM 213852 213900 48 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1602924 1604492 1568 0.1
RAM 210740 210780 40 0.0
light cy8ckit_062s2_43012 FLASH 1468652 1468732 80 0.0
RAM 196936 196936 0 0.0
lock cy8ckit_062s2_43012 FLASH 1496788 1496772 -16 -0.0
RAM 224720 224720 0 0.0
qpg lighting-app qpg6200+debug FLASH 840292 840292 0 0.0
RAM 127764 127764 0 0.0
lock-app qpg6200+debug FLASH 778904 778888 -16 -0.0
RAM 118712 118712 0 0.0
realtek light-switch-app rtl8777g FLASH 704952 704936 -16 -0.0
RAM 113440 113440 0 0.0
lighting-app rtl8777g FLASH 750672 750832 160 0.0
RAM 114640 114640 0 0.0
stm32 light STM32WB5MM-DK FLASH 477280 477440 160 0.0
RAM 141280 141280 0 0.0
telink bridge-app tl7218x FLASH 714884 727816 12932 1.8
RAM 93564 95756 2192 2.3
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 840238 851362 11124 1.3
RAM 42856 44148 1292 3.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 720662 725062 4400 0.6
RAM 54800 55728 928 1.7
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 783726 787688 3962 0.5
RAM 74504 74912 408 0.5
light-switch-app-ota-factory-data tl3218x_retention FLASH 725086 725062 -24 -0.0
RAM 33212 33212 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 613776 613962 186 0.0
RAM 118192 118196 4 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 829136 841616 12480 1.5
RAM 95092 97240 2148 2.3

@arielsz71 arielsz71 marked this pull request as ready for review February 18, 2026 22:37
@arielsz71 arielsz71 requested a review from s07641069 as a code owner February 18, 2026 22:37
@arielsz71 arielsz71 requested review from a team as code owners February 18, 2026 22:37
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

PR #43204: Size comparison from 4d6f12f to 248baea

Full report (34 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section 4d6f12f 248baea change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1108150 1108150 0 0.0
RAM 178674 178674 0 0.0
bl702 lighting-app bl702+eth FLASH 663226 663226 0 0.0
RAM 134689 134689 0 0.0
bl702+wifi FLASH 838932 838932 0 0.0
RAM 124229 124229 0 0.0
bl706+mfd+rpc+littlefs FLASH 1073160 1073160 0 0.0
RAM 117157 117157 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 905774 905774 0 0.0
RAM 105748 105748 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 986226 986226 0 0.0
RAM 109644 109644 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777652 777652 0 0.0
RAM 103288 103288 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786000 786000 0 0.0
RAM 108504 108504 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 731076 732272 1196 0.2
RAM 97268 97308 40 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 715596 715596 0 0.0
RAM 97468 97468 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 556508 557896 1388 0.2
RAM 204456 204496 40 0.0
lock CC3235SF_LAUNCHXL FLASH 590704 590704 0 0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 969152 969144 -8 -0.0
RAM 125476 125476 0 0.0
BRD4338a FLASH 757724 757716 -8 -0.0
RAM 237712 237712 0 0.0
window-app BRD4187C FLASH 1066872 1066864 -8 -0.0
RAM 126700 126700 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 956056 957428 1372 0.1
RAM 162085 162127 42 0.0
nxp contact mcxw71+release FLASH 746448 746448 0 0.0
RAM 66912 66912 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1701916 1703516 1600 0.1
RAM 213860 213900 40 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1602924 1604524 1600 0.1
RAM 210748 210788 40 0.0
light cy8ckit_062s2_43012 FLASH 1468764 1468764 0 0.0
RAM 196944 196944 0 0.0
lock cy8ckit_062s2_43012 FLASH 1496804 1496804 0 0.0
RAM 224720 224720 0 0.0
qpg lighting-app qpg6200+debug FLASH 840308 840308 0 0.0
RAM 127772 127772 0 0.0
lock-app qpg6200+debug FLASH 778904 778904 0 0.0
RAM 118720 118720 0 0.0
realtek light-switch-app rtl8777g FLASH 704952 704952 0 0.0
RAM 113440 113440 0 0.0
lighting-app rtl8777g FLASH 750848 750848 0 0.0
RAM 114648 114648 0 0.0
stm32 light STM32WB5MM-DK FLASH 477456 477456 0 0.0
RAM 141280 141280 0 0.0
telink bridge-app tl7218x FLASH 726494 727824 1330 0.2
RAM 95712 95760 48 0.1
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 851370 851370 0 0.0
RAM 44152 44152 0 0.0
tl7218x FLASH 842770 842770 0 0.0
RAM 99536 99536 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 725070 725070 0 0.0
RAM 55732 55732 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 787696 787696 0 0.0
RAM 74916 74916 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 725070 725070 0 0.0
RAM 33216 33216 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 613970 613970 0 0.0
RAM 118200 118200 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 841620 841624 4 0.0
RAM 97244 97244 0 0.0

@@ -0,0 +1,24 @@
# This cluster is currently following a code driven approach.

# This means that the Accessors for the attribute MeasuredValue are no longer available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getter is still there, right? Just not setter. And getter will not get the "current" value, just the default one.

But if we stop getting it in CodegenIntegration, we could make the getter go away too, right?

Comment on lines +52 to +53
DataModel::Nullable<int16_t> measuredValue{};
MeasuredValue::Get(endpointId, measuredValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it makes sense to have a ZAP-configured MeasuredValue... I think we should just start the cluster off with null until the app actually provides a measurement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decouple Temperature Measurement cluster

4 participants

Comments