Skip to content

Conversation

@nickolas-deboom
Copy link
Contributor

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

PercentSetting is subscribed in addition to PercentCurrent to set fanSpeedPercent, 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.

@github-actions
Copy link

Duplicate profile check: Passed - no duplicate profiles detected.

@github-actions
Copy link

@github-actions
Copy link

github-actions bot commented Sep 24, 2025

Test Results

   71 files    466 suites   0s ⏱️
2 415 tests 2 415 ✅ 0 💤 0 ❌
4 113 runs  4 113 ✅ 0 💤 0 ❌

Results for commit e6561f4.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Sep 24, 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 e6561f4

@nickolas-deboom nickolas-deboom force-pushed the use-fan-speed-percentage branch 2 times, most recently from df06872 to ae3bd7f Compare September 24, 2025 21:51
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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Restored in latest force push


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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in latest force push

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.
@nickolas-deboom nickolas-deboom force-pushed the use-fan-speed-percentage branch from cd97c74 to e6561f4 Compare November 11, 2025 21:13
@nickolas-deboom nickolas-deboom changed the base branch from main to add-fan-speed-percent-for-thermostats November 11, 2025 21:13
@nickolas-deboom nickolas-deboom changed the title Use fanSpeedPercent for thermostats Use PercentSetting to set fanSpeedPercent Nov 11, 2025
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