Skip to content

Thermostat - Relocate setpoint logic to separate files#42326

Open
hasty wants to merge 74 commits into
project-chip:masterfrom
hasty:granbery/cluster_driven_thermostat_setpoints
Open

Thermostat - Relocate setpoint logic to separate files#42326
hasty wants to merge 74 commits into
project-chip:masterfrom
hasty:granbery/cluster_driven_thermostat_setpoints

Conversation

@hasty

@hasty hasty commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR moves the setpoint functionality of the Thermostat cluster into a separate file, in preparation for migrating to a code-driven-cluster implementation of Thermostat.

Related issues

This is meant to be merged after #41739 and #41772.

Testing

Ran test suite.

@hasty hasty changed the title Granbery/cluster driven thermostat setpoints [HVAC] Thermostat - Relocate setpoint logic to separate file Dec 8, 2025
@mergify mergify Bot added the conflict label Dec 8, 2025
@hasty hasty changed the title [HVAC] Thermostat - Relocate setpoint logic to separate file [Draft] Thermostat - Relocate setpoint logic to separate file Dec 8, 2025

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

Copy link
Copy Markdown
Contributor

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 successfully refactors the Thermostat cluster by moving setpoint-related logic into new dedicated files, ThermostatClusterSetpoints.cpp and ThermostatClusterSetpoints.h. This improves modularity and prepares for a code-driven cluster implementation. The changes also include updating the default value for minSetpointDeadBand across various examples and tests, which is a good consistency improvement. My review includes suggestions to further improve the refactoring by using the new GetSetpointLimits helper function in a couple of places where limit attributes are still being fetched manually, aligning with the rule to extract common logic into helper functions. This will make the code cleaner and more consistent.

Comment thread src/app/clusters/thermostat-server/ThermostatCluster.cpp Outdated
Comment thread src/app/clusters/thermostat-server/ThermostatClusterSetpoints.cpp Outdated
@mergify mergify Bot removed the conflict label Dec 8, 2025
@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

PR #42326: Size comparison from efdf99d to 99f09f4

Full report (32 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, psoc6, qpg, realtek, stm32, telink)
platform target config section efdf99d 99f09f4 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1105860 1105860 0 0.0
RAM 178954 178954 0 0.0
bl702 lighting-app bl702+eth FLASH 660680 660680 0 0.0
RAM 135025 135025 0 0.0
bl702+wifi FLASH 836530 836530 0 0.0
RAM 124485 124485 0 0.0
bl706+mfd+rpc+littlefs FLASH 1070174 1070174 0 0.0
RAM 117341 117341 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 902384 902384 0 0.0
RAM 105932 105932 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 982920 982920 0 0.0
RAM 109844 109844 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 770776 770776 0 0.0
RAM 103392 103392 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 783588 783588 0 0.0
RAM 108712 108712 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 728616 728616 0 0.0
RAM 97452 97452 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 713064 713064 0 0.0
RAM 97660 97660 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 554588 554460 -128 -0.0
RAM 205472 205472 0 0.0
lock CC3235SF_LAUNCHXL FLASH 588528 588528 0 0.0
RAM 205720 205720 0 0.0
efr32 lock-app BRD4187C FLASH 964748 964748 0 0.0
RAM 123776 123776 0 0.0
BRD4338a FLASH 759072 759072 0 0.0
RAM 254388 254388 0 0.0
window-app BRD4187C FLASH 1059888 1059888 0 0.0
RAM 120004 120004 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1680956 1680956 0 0.0
RAM 214188 214188 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1595436 1595452 16 0.0
RAM 211364 211364 0 0.0
light cy8ckit_062s2_43012 FLASH 1460060 1460060 0 0.0
RAM 197800 197800 0 0.0
lock cy8ckit_062s2_43012 FLASH 1494004 1494004 0 0.0
RAM 225672 225672 0 0.0
qpg lighting-app qpg6200+debug FLASH 838248 838248 0 0.0
RAM 127984 127984 0 0.0
lock-app qpg6200+debug FLASH 775984 775984 0 0.0
RAM 118920 118920 0 0.0
realtek light-switch-app rtl8777g FLASH 708688 708688 0 0.0
RAM 107188 107188 0 0.0
lighting-app rtl8777g FLASH 757392 757392 0 0.0
RAM 127320 127320 0 0.0
stm32 light STM32WB5MM-DK FLASH 470244 470244 0 0.0
RAM 141392 141392 0 0.0
telink bridge-app tl7218x FLASH 703898 703898 0 0.0
RAM 90760 90760 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 790246 790246 0 0.0
RAM 41176 41176 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 781558 781558 0 0.0
RAM 93860 93860 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 710042 710042 0 0.0
RAM 52232 52232 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 745874 745874 0 0.0
RAM 71256 71256 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 720554 720554 0 0.0
RAM 34956 34956 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 602362 602362 0 0.0
RAM 117736 117736 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 815066 815070 4 0.0
RAM 92248 92248 0 0.0

…driven_thermostat

# Conflicts:
#	examples/all-clusters-app/linux/main-common.cpp
@github-actions

github-actions Bot commented Dec 8, 2025

Copy link
Copy Markdown

PR #42326: Size comparison from efdf99d to 18fd2e4

Full report (35 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section efdf99d 18fd2e4 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1105860 1105616 -244 -0.0
RAM 178954 178970 16 0.0
bl702 lighting-app bl702+eth FLASH 660680 660708 28 0.0
RAM 135025 135041 16 0.0
bl702+wifi FLASH 836530 836292 -238 -0.0
RAM 124485 124501 16 0.0
bl706+mfd+rpc+littlefs FLASH 1070174 1070018 -156 -0.0
RAM 117341 117373 32 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 902384 902642 258 0.0
RAM 105932 105948 16 0.0
lighting-app bl702l+mfd+littlefs FLASH 982920 983020 100 0.0
RAM 109844 109876 32 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 770776 770680 -96 -0.0
RAM 103392 103400 8 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 783588 783692 104 0.0
RAM 108712 108728 16 0.0
pump-app LP_EM_CC1354P10_6 FLASH 728616 728708 92 0.0
RAM 97452 97468 16 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 713064 713284 220 0.0
RAM 97660 97676 16 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 554588 554412 -176 -0.0
RAM 205472 205480 8 0.0
lock CC3235SF_LAUNCHXL FLASH 588528 588416 -112 -0.0
RAM 205720 205736 16 0.0
efr32 lock-app BRD4187C FLASH 964748 964880 132 0.0
RAM 123776 123808 32 0.0
BRD4338a FLASH 759072 759312 240 0.0
RAM 254388 254404 16 0.0
window-app BRD4187C FLASH 1059888 1060284 396 0.0
RAM 120004 120004 0 0.0
esp32 all-clusters-app c3devkit DRAM 102812 102820 8 0.0
FLASH 1830854 1830496 -358 -0.0
IRAM 93540 93540 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 936264 935964 -300 -0.0
RAM 161724 161736 12 0.0
nxp contact mcxw71+release FLASH 695104 695416 312 0.0
RAM 61744 61776 32 0.1
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1680956 1680884 -72 -0.0
RAM 214188 214204 16 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1595436 1595404 -32 -0.0
RAM 211364 211372 8 0.0
light cy8ckit_062s2_43012 FLASH 1460060 1460060 0 0.0
RAM 197800 197808 8 0.0
lock cy8ckit_062s2_43012 FLASH 1494004 1494140 136 0.0
RAM 225672 225688 16 0.0
qpg lighting-app qpg6200+debug FLASH 838248 837996 -252 -0.0
RAM 127984 127992 8 0.0
lock-app qpg6200+debug FLASH 775984 775980 -4 -0.0
RAM 118920 118944 24 0.0
realtek light-switch-app rtl8777g FLASH 708688 709000 312 0.0
RAM 107188 107204 16 0.0
lighting-app rtl8777g FLASH 757392 757408 16 0.0
RAM 127320 127336 16 0.0
stm32 light STM32WB5MM-DK FLASH 470244 470048 -196 -0.0
RAM 141392 141400 8 0.0
telink bridge-app tl7218x FLASH 703898 704336 438 0.1
RAM 90760 90772 12 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 790246 790494 248 0.0
RAM 41176 41208 32 0.1
light-app-ota-shell-factory-data tl7218x FLASH 781558 781858 300 0.0
RAM 93860 93872 12 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 710042 710474 432 0.1
RAM 52232 52244 12 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 745874 746306 432 0.1
RAM 71256 71268 12 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 720554 720960 406 0.1
RAM 34956 34972 16 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 602362 602602 240 0.0
RAM 117736 117768 32 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 815066 815380 314 0.0
RAM 92248 92260 12 0.0

@github-actions

github-actions Bot commented Dec 9, 2025

Copy link
Copy Markdown

PR #42326: Size comparison from 9a96230 to 8a7bc0a

Full report (35 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section 9a96230 8a7bc0a change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1105616 1105616 0 0.0
RAM 178970 178970 0 0.0
bl702 lighting-app bl702+eth FLASH 660708 660708 0 0.0
RAM 135041 135041 0 0.0
bl702+wifi FLASH 836292 836292 0 0.0
RAM 124501 124501 0 0.0
bl706+mfd+rpc+littlefs FLASH 1070018 1070018 0 0.0
RAM 117373 117373 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 902642 902642 0 0.0
RAM 105948 105948 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 983020 983020 0 0.0
RAM 109876 109876 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 770680 770680 0 0.0
RAM 103400 103400 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 783692 783692 0 0.0
RAM 108728 108728 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 728708 728708 0 0.0
RAM 97468 97468 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 713284 713284 0 0.0
RAM 97676 97676 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 554540 554412 -128 -0.0
RAM 205480 205480 0 0.0
lock CC3235SF_LAUNCHXL FLASH 588416 588416 0 0.0
RAM 205736 205736 0 0.0
efr32 lock-app BRD4187C FLASH 964880 964880 0 0.0
RAM 123808 123808 0 0.0
BRD4338a FLASH 759312 759312 0 0.0
RAM 254404 254404 0 0.0
window-app BRD4187C FLASH 1060292 1060284 -8 -0.0
RAM 120004 120004 0 0.0
esp32 all-clusters-app c3devkit DRAM 102820 102820 0 0.0
FLASH 1830466 1830496 30 0.0
IRAM 93540 93540 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 936020 935964 -56 -0.0
RAM 161736 161736 0 0.0
nxp contact mcxw71+release FLASH 695416 695416 0 0.0
RAM 61776 61776 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1680884 1680884 0 0.0
RAM 214204 214204 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1595388 1595404 16 0.0
RAM 211372 211372 0 0.0
light cy8ckit_062s2_43012 FLASH 1460060 1460060 0 0.0
RAM 197808 197808 0 0.0
lock cy8ckit_062s2_43012 FLASH 1494140 1494140 0 0.0
RAM 225688 225688 0 0.0
qpg lighting-app qpg6200+debug FLASH 837996 837996 0 0.0
RAM 127992 127992 0 0.0
lock-app qpg6200+debug FLASH 775980 775980 0 0.0
RAM 118944 118944 0 0.0
realtek light-switch-app rtl8777g FLASH 709000 709000 0 0.0
RAM 107204 107204 0 0.0
lighting-app rtl8777g FLASH 757408 757408 0 0.0
RAM 127336 127336 0 0.0
stm32 light STM32WB5MM-DK FLASH 470048 470048 0 0.0
RAM 141400 141400 0 0.0
telink bridge-app tl7218x FLASH 704336 704336 0 0.0
RAM 90772 90772 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 790494 790494 0 0.0
RAM 41208 41208 0 0.0
light-app-ota-shell-factory-data tl7218x FLASH 781858 781858 0 0.0
RAM 93872 93872 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 710474 710474 0 0.0
RAM 52244 52244 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 746306 746306 0 0.0
RAM 71268 71268 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 720960 720960 0 0.0
RAM 34972 34972 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 602602 602602 0 0.0
RAM 117768 117768 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 815376 815380 4 0.0
RAM 92260 92260 0 0.0

@lboue

lboue commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Any news?

@mergify mergify Bot added the conflict label Apr 11, 2026
@hasty hasty force-pushed the granbery/cluster_driven_thermostat_setpoints branch from bc1c1b7 to e9b7549 Compare April 11, 2026 18:13
@mergify mergify Bot removed the conflict label Apr 11, 2026
@hasty hasty force-pushed the granbery/cluster_driven_thermostat_setpoints branch from e9b7549 to f5cbd69 Compare April 11, 2026 18:19
@github-actions

Copy link
Copy Markdown

PR #42326: Size comparison from a914062 to f5cbd69

Full report (3 builds for realtek, stm32)
platform target config section a914062 f5cbd69 change % change
realtek light-switch-app rtl8777g FLASH 680824 680824 0 0.0
RAM 101600 101600 0 0.0
lighting-app rtl8777g FLASH 724768 724768 0 0.0
RAM 101956 101956 0 0.0
stm32 light STM32WB5MM-DK FLASH 475468 475468 0 0.0
RAM 141388 141388 0 0.0

@hasty hasty force-pushed the granbery/cluster_driven_thermostat_setpoints branch 3 times, most recently from 41a0d50 to 18932e9 Compare April 11, 2026 20:27
@github-actions

github-actions Bot commented Apr 11, 2026

Copy link
Copy Markdown

PR #42326: Size comparison from a914062 to 18932e9

Full report (28 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, psoc6, qpg, realtek, stm32, telink)
platform target config section a914062 18932e9 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1090510 1090510 0 0.0
RAM 144858 144858 0 0.0
bl616 lighting-app bl616+thread FLASH 1101988 1101988 0 0.0
RAM 104280 104280 0 0.0
bl616+wifi+shell FLASH 1588876 1588876 0 0.0
RAM 98176 98176 0 0.0
bl702 lighting-app bl702+eth FLASH 1053666 1053666 0 0.0
RAM 108461 108461 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 892364 892364 0 0.0
RAM 105852 105852 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 775904 775904 0 0.0
RAM 103396 103396 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 788108 788108 0 0.0
RAM 108588 108588 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 734432 734432 0 0.0
RAM 97396 97396 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 717860 717860 0 0.0
RAM 97556 97556 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 559874 559258 -616 -0.1
RAM 204568 204568 0 0.0
lock CC3235SF_LAUNCHXL FLASH 592742 592742 0 0.0
RAM 204816 204816 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1711836 1711492 -344 -0.0
RAM 214020 214020 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1609292 1608868 -424 -0.0
RAM 210908 210908 0 0.0
light cy8ckit_062s2_43012 FLASH 1466876 1466876 0 0.0
RAM 197068 197068 0 0.0
lock cy8ckit_062s2_43012 FLASH 1499596 1499596 0 0.0
RAM 224820 224820 0 0.0
qpg lighting-app qpg6200+debug FLASH 842684 842684 0 0.0
RAM 127868 127868 0 0.0
lock-app qpg6200+debug FLASH 781300 781300 0 0.0
RAM 118816 118816 0 0.0
realtek light-switch-app rtl8777g FLASH 680824 680824 0 0.0
RAM 101600 101600 0 0.0
lighting-app rtl8777g FLASH 724768 724768 0 0.0
RAM 101956 101956 0 0.0
stm32 light STM32WB5MM-DK FLASH 475468 475468 0 0.0
RAM 141388 141388 0 0.0
telink bridge-app tl7218x FLASH 730822 730822 0 0.0
RAM 95924 95924 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 850332 850332 0 0.0
RAM 44340 44340 0 0.0
tl7218x FLASH 841738 841738 0 0.0
RAM 99724 99724 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 730236 730236 0 0.0
RAM 55984 55984 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 793462 793462 0 0.0
RAM 75160 75160 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 730180 730180 0 0.0
RAM 33468 33468 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 613142 613142 0 0.0
RAM 118396 118396 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 839872 839876 4 0.0
RAM 97432 97432 0 0.0

@codecov

codecov Bot commented Apr 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 528 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.56%. Comparing base (f4d8ecb) to head (d65e4cd).

Files with missing lines Patch % Lines
src/app/clusters/thermostat-server/Setpoints.cpp 0.00% 276 Missing ⚠️
...s/thermostat-server/ThermostatClusterSetpoints.cpp 0.00% 119 Missing ⚠️
src/app/clusters/thermostat-server/Setpoint.cpp 0.00% 24 Missing ⚠️
.../clusters/thermostat-server/SetpointAttributes.cpp 0.00% 24 Missing ⚠️
...p/clusters/thermostat-server/ThermostatCluster.cpp 0.00% 23 Missing ⚠️
src/app/clusters/thermostat-server/Setpoints.h 0.00% 19 Missing ⚠️
src/app/clusters/thermostat-server/Setpoint.h 0.00% 12 Missing ⚠️
...ers/thermostat-server/ThermostatClusterPresets.cpp 0.00% 12 Missing ⚠️
...pp/clusters/thermostat-server/SetpointAttributes.h 0.00% 9 Missing ⚠️
...rc/app/clusters/thermostat-server/SetpointLimits.h 0.00% 9 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #42326      +/-   ##
==========================================
- Coverage   56.61%   56.56%   -0.05%     
==========================================
  Files        1642     1651       +9     
  Lines      113137   113228      +91     
  Branches    13243    13237       -6     
==========================================
+ Hits        64048    64049       +1     
- Misses      49089    49179      +90     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hasty hasty force-pushed the granbery/cluster_driven_thermostat_setpoints branch from 18932e9 to 0d736be Compare April 11, 2026 21:19
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

PR #42326: Size comparison from ca3e67c to b419229

Full report (35 builds for bl602, bl616, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
platform target config section ca3e67c b419229 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1094324 1094324 0 0.0
RAM 144882 144882 0 0.0
bl616 lighting-app bl616+thread FLASH 1105636 1105636 0 0.0
RAM 104280 104280 0 0.0
bl616+wifi+shell FLASH 1593424 1593424 0 0.0
RAM 98176 98176 0 0.0
bl702 lighting-app bl702+eth FLASH 1057326 1057326 0 0.0
RAM 108509 108509 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 896162 896162 0 0.0
RAM 105884 105884 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 776976 776976 0 0.0
RAM 103388 103388 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 789744 789744 0 0.0
RAM 108676 108676 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 738868 738868 0 0.0
RAM 97596 97596 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 719032 719032 0 0.0
RAM 97636 97636 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 568818 569506 688 0.1
RAM 205056 205056 0 0.0
lock CC3235SF_LAUNCHXL FLASH 596298 596298 0 0.0
RAM 205256 205256 0 0.0
efr32 lock-app BRD4187C FLASH 994188 994188 0 0.0
RAM 131288 131288 0 0.0
BRD4338a FLASH 798741 798741 0 0.0
RAM 243424 243424 0 0.0
window-app BRD4187C FLASH 1100608 1100608 0 0.0
RAM 130360 130360 0 0.0
esp32 all-clusters-app c3devkit DRAM 99716 99716 0 0.0
FLASH 1621642 1623250 1608 0.1
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 834276 835012 736 0.1
RAM 157540 157540 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1733676 1735260 1584 0.1
RAM 215260 215260 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1622756 1623908 1152 0.1
RAM 211548 211548 0 0.0
light cy8ckit_062s2_43012 FLASH 1469988 1469988 0 0.0
RAM 197420 197420 0 0.0
lock cy8ckit_062s2_43012 FLASH 1503428 1503428 0 0.0
RAM 225252 225252 0 0.0
qpg lighting-app qpg6200+debug FLASH 844200 844200 0 0.0
RAM 127948 127948 0 0.0
lock-app qpg6200+debug FLASH 782276 782276 0 0.0
RAM 118856 118856 0 0.0
realtek light-switch-app rtl8777g FLASH 688760 688760 0 0.0
RAM 101764 101764 0 0.0
lighting-app rtl8777g FLASH 729712 729712 0 0.0
RAM 102044 102044 0 0.0
stm32 light STM32WB5MM-DK FLASH 478416 478416 0 0.0
RAM 141476 141476 0 0.0
telink all-devices-app tl7218x FLASH 813116 813116 0 0.0
RAM 97196 97196 0 0.0
tlsr9118bdk40d FLASH 606574 606574 0 0.0
RAM 120152 120152 0 0.0
bridge-app tl7218x FLASH 731480 731480 0 0.0
RAM 95864 95864 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 851824 851824 0 0.0
RAM 44332 44332 0 0.0
tl7218x FLASH 843152 843152 0 0.0
RAM 99656 99656 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 731974 731974 0 0.0
RAM 55980 55980 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 795200 795200 0 0.0
RAM 75164 75164 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 731904 731904 0 0.0
RAM 33468 33468 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 614610 614610 0 0.0
RAM 118496 118496 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 841268 841272 4 0.0
RAM 97364 97364 0 0.0

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

Copy link
Copy Markdown
Contributor

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 refactors the thermostat server cluster by introducing a modular, object-oriented setpoint management architecture (including Setpoint, SetpointLimits, and Setpoints classes) to replace legacy procedural validation logic, alongside updating Python test suites to use a simulated thermostat state. The review feedback highlights several critical and high-severity issues: a potential crash in OptionalSetpoint::Encode when calling .Value() on an uninitialized optional, unsafe downcasting in isEqual that should be replaced with a safe base-class operator==, redundant temperature casts in Setpoints::Valid that risk signed integer overflow, and redundant conditional checks in SetpointRaiseLower that can be simplified.

Comment thread src/app/clusters/thermostat-server/Setpoint.cpp Outdated
Comment thread src/app/clusters/thermostat-server/Setpoint.h Outdated
Comment thread src/app/clusters/thermostat-server/Setpoint.h Outdated
Comment thread src/app/clusters/thermostat-server/Setpoint.h Outdated
Comment thread src/app/clusters/thermostat-server/Setpoints.cpp
Comment thread src/app/clusters/thermostat-server/ThermostatClusterSetpoints.cpp

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Comment on lines +90 to +91
if (mTemperature.HasValue())
return mTemperature.Value();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure if we have a requirement for this, but might be worth adding the brackets just to be consistent?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (mTemperature.HasValue())
return mTemperature.Value();
if (mTemperature.HasValue())
{
return mTemperature.Value();
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It does not look like it got sorted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in a different place, but now fixed in both.

Comment thread src/app/clusters/thermostat-server/Setpoints.cpp Outdated
Comment thread src/app/clusters/thermostat-server/Setpoints.cpp Outdated
Comment thread src/app/clusters/thermostat-server/Setpoints.cpp
Comment thread src/app/clusters/thermostat-server/Setpoints.cpp Outdated
Comment thread src/app/clusters/thermostat-server/ThermostatCluster.cpp
Comment thread src/app/clusters/thermostat-server/ThermostatClusterSetpoints.cpp
Comment thread src/app/clusters/thermostat-server/ThermostatClusterSetpoints.cpp Outdated
@hasty hasty changed the title Thermostat - Relocate setpoint logic to separate file Thermostat - Relocate setpoint logic to separate files Jun 10, 2026
@hasty

hasty commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 refactors the thermostat cluster server's setpoint handling by introducing a structured Setpoints class and associated helper classes to manage validation, limits, and deadband enforcement. It also updates the corresponding Python tests to utilize a simulator matching this new logic. The review feedback identifies several critical issues that must be addressed: bugs in Setpoints::Valid() and Setpoints::FixUserLimits() that break compatibility with devices not supporting optional setpoint attributes, a compilation error in ThermostatCluster.cpp caused by referencing the non-existent chip::Encoding::Get8 function, and a code smell in Setpoint.h involving a reference member in a copy-assigned class that should be refactored to a pointer.

Comment thread src/app/clusters/thermostat-server/Setpoints.cpp
Comment thread src/app/clusters/thermostat-server/Setpoints.cpp
Comment thread src/app/clusters/thermostat-server/ThermostatCluster.cpp
Comment thread src/app/clusters/thermostat-server/Setpoint.h
Comment thread src/app/clusters/thermostat-server/Setpoint.cpp
@github-actions

github-actions Bot commented Jun 28, 2026

Copy link
Copy Markdown

PR #42326: Size comparison from f4d8ecb to d65e4cd

Full report (30 builds for cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, psoc6, qpg, realtek, stm32, telink)
platform target config section f4d8ecb d65e4cd change % change
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777384 777384 0 0.0
RAM 103404 103404 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 790136 790136 0 0.0
RAM 108684 108684 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 739392 739392 0 0.0
RAM 97612 97612 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 719564 719564 0 0.0
RAM 97644 97644 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 569670 570350 680 0.1
RAM 205112 205112 0 0.0
lock CC3235SF_LAUNCHXL FLASH 597230 597230 0 0.0
RAM 205272 205272 0 0.0
efr32 lighting-app BRD4187C FLASH 1104716 1104716 0 0.0
RAM 135360 135360 0 0.0
lock-app BRD4187C FLASH 995184 995184 0 0.0
RAM 131292 131292 0 0.0
BRD4338a FLASH 799825 799825 0 0.0
RAM 243432 243432 0 0.0
esp32 all-clusters-app c3devkit DRAM 99556 99556 0 0.0
FLASH 1626306 1627922 1616 0.1
IRAM 94776 94776 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 845892 846604 712 0.1
RAM 157923 157923 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1752716 1754220 1504 0.1
RAM 215644 215644 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1626564 1627660 1096 0.1
RAM 211604 211604 0 0.0
light cy8ckit_062s2_43012 FLASH 1470876 1470876 0 0.0
RAM 197436 197436 0 0.0
lock cy8ckit_062s2_43012 FLASH 1504324 1504324 0 0.0
RAM 225268 225268 0 0.0
qpg lighting-app qpg6200+debug FLASH 843172 843172 0 0.0
RAM 127908 127908 0 0.0
lock-app qpg6200+debug FLASH 783008 783008 0 0.0
RAM 118840 118840 0 0.0
realtek light-switch-app rtl8777g FLASH 689392 689392 0 0.0
RAM 101780 101780 0 0.0
lighting-app rtl8777g FLASH 730320 730320 0 0.0
RAM 102052 102052 0 0.0
stm32 light STM32WB5MM-DK FLASH 478996 478996 0 0.0
RAM 141492 141492 0 0.0
telink all-devices-app tl7218x FLASH 881732 881732 0 0.0
RAM 99716 99716 0 0.0
tlsr9118bdk40d FLASH 673338 673338 0 0.0
RAM 120848 120848 0 0.0
bridge-app tl7218x FLASH 734172 734172 0 0.0
RAM 97700 97700 0 0.0
light-app-ota-compress-lzma-factory-data tl3218x FLASH 800698 800698 0 0.0
RAM 42380 42380 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl7218x FLASH 845838 845838 0 0.0
RAM 101492 101492 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 734730 734730 0 0.0
RAM 57824 57824 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 795818 795818 0 0.0
RAM 75176 75176 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 734646 734646 0 0.0
RAM 34480 34480 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 615230 615230 0 0.0
RAM 118508 118508 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 842054 842058 4 0.0
RAM 97376 97376 0 0.0

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.

5 participants