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    468 suites   0s ⏱️
2 455 tests 2 455 ✅ 0 💤 0 ❌
4 168 runs  4 168 ✅ 0 💤 0 ❌

Results for commit 353f6c0.

♻️ 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/embedded-cluster-utils.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/init.lua 89%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 353f6c0

@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

…2428)

Off is an optional enum value for SystemMode and setting fanMode to Off
may have no effect if the thermostat mode is set to heating or cooling.
This commit removes this value from supportedFanModes attribute unless
Off is reported by the SystemMode attribute at some point.

-- 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.

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

Comment on lines +1597 to 1598
local event = supported_fan_modes_attribute(supported_fan_modes, {visibility = {displayed = false}})
device:emit_event_for_endpoint(ib.endpoint_id, event)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
local event = supported_fan_modes_attribute(supported_fan_modes, {visibility = {displayed = false}})
device:emit_event_for_endpoint(ib.endpoint_id, event)
device:emit_event_for_endpoint(ib.endpoint_id, supported_fan_modes_attribute(supported_fan_modes, {visibility = {displayed = false}}))

nit

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.

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