Skip to content

Aligned handlers and fields in value magnitude and added tests#3111

Merged
aleclorimer merged 3 commits into
mainfrom
zb-thermostat-zenwithin-overflow-fix
Jul 21, 2026
Merged

Aligned handlers and fields in value magnitude and added tests#3111
aleclorimer merged 3 commits into
mainfrom
zb-thermostat-zenwithin-overflow-fix

Conversation

@aleclorimer

Copy link
Copy Markdown
Contributor

Fixed a bug where (min|max)(Heat|Cool)SetPoint was being set in centidegrees and then being used to clamp a value in degrees causing the clamped value to have an Int16 overflow error when then tried to scale to centidegrees.

Mutant testing: Failing without the / 100.0 fix/update.

@aleclorimer
aleclorimer requested review from tpmanley and varzac July 9, 2026 16:16
@aleclorimer aleclorimer added the CGAI Contains code that was generated by AI label Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Channel deleted.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Test Results

   73 files  ± 0    536 suites   - 2   0s ⏱️ ±0s
3 203 tests +11  3 203 ✅ +11  0 💤 ±0  0 ❌ ±0 
5 192 runs   -  1  5 192 ✅  -  1  0 💤 ±0  0 ❌ ±0 

Results for commit e566c1b. ± Comparison against base commit 4a06ba8.

This pull request removes 2 and adds 13 tests. Note that renamed tests count towards both.
Zone Management setSensitivity command should handle global sensitivity when per-zone sensitivity is unsupported
Zone Management trigger reports should omit sensitivity when per-zone sensitivity is unsupported, even if provided by client
Camera profile should include zoneManagement when USER_DEFINED feature is present
Camera profile should not include zoneManagement when USER_DEFINED feature is missing
Cooling setpoint is clamped to MaxCoolSetpointLimit
Cooling setpoint is clamped to MinCoolSetpointLimit
Heating setpoint is clamped to MaxHeatSetpointLimit
Heating setpoint is clamped to MinHeatSetpointLimit
MaxCoolSetpointLimit report stores device field
MaxHeatSetpointLimit report stores device field
MinCoolSetpointLimit report stores device field
MinHeatSetpointLimit report stores device field
…

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

File Coverage
All files 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/zenwithin/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/resideo_korea/init.lua 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/wallhero/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/popp/init.lua 92%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/sinope/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/stelpro/init.lua 87%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/aqara/init.lua 94%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/stelpro-ki-zigbee-thermostat/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/lux-konoz/can_handle.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/vimar/init.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/init.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zigbee-thermostat/src/lazy_load_subdriver.lua 57%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against e566c1b

@aleclorimer
aleclorimer force-pushed the zb-thermostat-zenwithin-overflow-fix branch from e2b0384 to 08a32b8 Compare July 9, 2026 16:34
local setpoint_limit_handler = function(limit_type)
return function(driver, device, limit)
device:set_field(limit_type, limit.value, {persist = true})
device:set_field(limit_type, limit.value / 100.0, {persist = true})

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.

While this will fix it for future devices, this value is already persisted on existing devices, so even though I think this change makes more sense in a vacuum, for this fix, I think we need to keep persisting in centidegrees (and comment that we are doing such) and then do this division on the checks. We'll have to update the DEFAULT values as well

@aleclorimer
aleclorimer force-pushed the zb-thermostat-zenwithin-overflow-fix branch 2 times, most recently from aeac47a to 4254ba3 Compare July 9, 2026 20:22
Comment thread drivers/SmartThings/zigbee-thermostat/src/zenwithin/init.lua
Comment thread drivers/SmartThings/zigbee-thermostat/src/zenwithin/init.lua
@aleclorimer
aleclorimer force-pushed the zb-thermostat-zenwithin-overflow-fix branch 2 times, most recently from 55f504a to 2376ac9 Compare July 14, 2026 18:06
@aleclorimer
aleclorimer requested a review from cjswedes July 16, 2026 16:10
@aleclorimer
aleclorimer force-pushed the zb-thermostat-zenwithin-overflow-fix branch from 2376ac9 to d8fc967 Compare July 16, 2026 20:34
)

test.register_message_test(
"MinHeatSetpointLimit report stores device field",

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.

What is actually being tested here? Maybe needs to be a coroutine test to check device fields with get_field

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.

That the fields were actually being handled. I verified that it breaks the tests if the handlers are not set, but you're right. I should just check those values for more sanity while im at it. Updated

@aleclorimer
aleclorimer merged commit a975cc1 into main Jul 21, 2026
18 checks passed
@aleclorimer
aleclorimer deleted the zb-thermostat-zenwithin-overflow-fix branch July 21, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CGAI Contains code that was generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants