Skip to content

Conversation

nickolas-deboom
Copy link
Contributor

@nickolas-deboom nickolas-deboom commented Sep 24, 2025

This change adds the fanSpeedPercent capability to the thermostat-modular profile. Additionally, PercentSetting is subscribed in addition to PercentCurrent to set this capability, since it provides an accurate representation of the speed of the fan while helping avoid the following situation:
(1) The fan speed is changed in the app and PercentSetting is routed to the device
(2) The fan reports back a value of PercentCurrent that doesn't match PercentSetting because the speed takes a little while to change
(3) The fanSpeedPercent capability jumps to the value reported by PercentCurrent

PercentCurrent is still subscribed to, but its attribute handler is gated on the current fan mode being AUTO, in which case PercentSetting is NULL on the device side and PercentCurrent is used as a fallback for setting the capability.

Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

Copy link

Copy link

github-actions bot commented Sep 24, 2025

Test Results

   71 files    452 suites   0s ⏱️
2 350 tests 2 350 ✅ 0 💤 0 ❌
3 957 runs  3 957 ✅ 0 💤 0 ❌

Results for commit ae3bd7f.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Sep 24, 2025

File Coverage
All files 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/init.lua 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-thermostat/src/embedded-cluster-utils.lua 95%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against ae3bd7f

This change adds the fanSpeedPercent capability to the
thermostat-modular profile. Additionally, PercentSetting is subscribed
in addition to PercentCurrent to set this capability, since it provides an
accurate representation of the speed of the fan while helping avoid
the following situation:

(1) The fan speed is changed in the app and PercentSetting is routed to
the device
(2) The fan reports back a value of PercentCurrent that doesn't match
PercentSetting because the speed takes a little while to change
(3) The fanSpeedPercent capability jumps to the value reported by
PercentCurrent

PercentCurrent is still subscribed to, but its attribute handler is
gated on the current fan mode being AUTO, in which case PercentSetting
is NULL on the device side and PercentCurrent is used as a fallback for
setting the capability.
local function fan_speed_percent_attr_handler(driver, device, ib, response)
local speed = 0
if ib.data.value ~= nil then
speed = utils.clamp_value(ib.data.value, MIN_ALLOWED_PERCENT_VALUE, MAX_ALLOWED_PERCENT_VALUE)
Copy link
Contributor

Choose a reason for hiding this comment

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

probably shouldn't remove the clamp, right?


local function fan_speed_setting_attr_handler(driver, device, ib, response)
if ib.data.value == nil then return end
device:emit_event_for_endpoint(ib.endpoint_id, capabilities.fanSpeedPercent.percent(ib.data.value))
Copy link
Contributor

Choose a reason for hiding this comment

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

we probably want to clamp this as well

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.

2 participants