Skip to content

Conversation

@nickolas-deboom
Copy link
Contributor

This PR adds the fanSpeedPercent capability for thermostats. These changes were originally in #2425 but were extracted to a separate PR in order to support a faster turnaround, since by itself this is a very low risk change.

Note that a range of [1, 100] is enforced because the Off mode is not supported for thermostats.

@github-actions
Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link

@github-actions
Copy link

github-actions bot commented Nov 11, 2025

Test Results

   71 files    477 suites   0s ⏱️
2 471 tests 2 471 ✅ 0 💤 0 ❌
4 236 runs  4 236 ✅ 0 💤 0 ❌

Results for commit f0fd1ec.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Nov 11, 2025

File Coverage
All files 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/init.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/thermostat_handlers/attribute_handlers.lua 80%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/thermostat_handlers/capability_handlers.lua 88%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/thermostat_utils/legacy_device_configuration.lua 86%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/thermostat_utils/embedded_cluster_utils.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/thermostat_utils/utils.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/thermostat_utils/device_configuration.lua 91%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against f0fd1ec

@hcarter-775
Copy link
Contributor

hcarter-775 commented Nov 12, 2025

Since we're adding the [1,100] gating here for the fan, let's merge the remove "off" for thermostats first. Then everything will be cohesive.

@nickolas-deboom
Copy link
Contributor Author

Since we're adding the [1,100] gating here for the fan, let's merge the remove "off" for thermostats first. Then everything will be cohesive.

I agree, that PR is here for reference: #2428


-- remove 'off' as a supported fan mode for thermostat device types, unless the
-- device previously had 'off' as a supported fan mode to avoid breaking routines
if get_device_type(device) == THERMOSTAT_DEVICE_TYPE_ID then
Copy link
Contributor

Choose a reason for hiding this comment

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

have you checked if any routines use off? want to make sure this isn't superfluous at this point.

Copy link
Contributor

Choose a reason for hiding this comment

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

saw you rebased @nickolas-deboom, but I am still curious about this. Cause honestly even if there are like 2, it might be easier/better not to maintain this and ignore this whole code block

Copy link
Contributor Author

@nickolas-deboom nickolas-deboom Dec 4, 2025

Choose a reason for hiding this comment

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

Not sure about how many use off specifically, but I checked and there are 30 rules existing rules that use fanMode in some way, on two total devices.
Edit: actually there are 89 total rules in place across 31 devices.

Comment on lines 1589 to 1594
if not tbl_contains(prev_supported_fan_modes, "off") then
local _, off_idx = tbl_contains(supported_fan_modes, "off")
if off_idx then
table.remove(supported_fan_modes, off_idx)
end
end
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 starting to wonder, we don't expect this value to change, do we? I almost wonder if it makes sense to just return early if some prev_supported_fan_modes is found, or to just use this table rather than dynamically remove something off the newly made supported_fan_modes table.

However, if we don't go that route, then:

Suggested change
if not tbl_contains(prev_supported_fan_modes, "off") then
local _, off_idx = tbl_contains(supported_fan_modes, "off")
if off_idx then
table.remove(supported_fan_modes, off_idx)
end
end
-- per the definitions set above, the first index always contains "off"
if prev_supported_fan_modes[1] ~= "off" then
table.remove(supported_fan_modes, 1)
end

Copy link
Contributor

@hcarter-775 hcarter-775 Nov 20, 2025

Choose a reason for hiding this comment

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

I see this rule wouldn't work for thermostatFanMode. To solve this, I'd say do the following:

if get_device_type(device) == THERMOSTAT_DEVICE_TYPE_ID and device:supports_capability_by_id(capabilities.fanMode.ID) then

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated as suggested!

Copy link
Contributor

@hcarter-775 hcarter-775 left a comment

Choose a reason for hiding this comment

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

Realized I hadn't approved the PR that got merged into this one, so I'm just pulling this out while we sort out those details.

@nickolas-deboom nickolas-deboom force-pushed the add-fan-speed-percent-for-thermostats branch from 353f6c0 to ad29996 Compare December 4, 2025 19:02
@nickolas-deboom
Copy link
Contributor Author

@hcarter-775 I rebased this following the directory restructure and also addressed the feedback you left previously

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants