Matter fan: expose SET_SPEED for all fans via PercentSetting#169696
Open
lboue wants to merge 4 commits intohome-assistant:devfrom
Open
Matter fan: expose SET_SPEED for all fans via PercentSetting#169696lboue wants to merge 4 commits intohome-assistant:devfrom
lboue wants to merge 4 commits intohome-assistant:devfrom
Conversation
Contributor
|
Hey there @home-assistant/matter, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Contributor
There was a problem hiding this comment.
Pull request overview
Exposes FanEntityFeature.SET_SPEED for all Matter fans by treating PercentSetting as universally available, aligning Home Assistant fan speed control behavior with the Matter FanControl cluster’s mandatory attribute set.
Changes:
- Always enable
FanEntityFeature.SET_SPEEDfor Matter fans (regardless ofkMultiSpeed). - Keep
speed_countderived fromSpeedMaxonly whenkMultiSpeedis present; otherwise rely on the default (100). - Add a test verifying percentage control works for a fan with
FeatureMap = 0, and update snapshots to reflect the new supported features and percentage attributes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
homeassistant/components/matter/fan.py |
Enables SET_SPEED unconditionally during feature calculation. |
tests/components/matter/test_fan.py |
Adds coverage for set_percentage on non-MultiSpeed fans. |
tests/components/matter/snapshots/test_fan.ambr |
Updates snapshots for newly exposed percentage attributes and feature flags. |
Comment on lines
255
to
262
| self._attr_supported_features = FanEntityFeature(0) | ||
| # PercentSetting is always a mandatory attribute of the FanControl cluster, | ||
| # so percentage-based speed control is always available. | ||
| self._attr_supported_features |= FanEntityFeature.SET_SPEED | ||
| if feature_map & FanControlFeature.kMultiSpeed: | ||
| self._attr_supported_features |= FanEntityFeature.SET_SPEED | ||
| self._attr_speed_count = int( | ||
| self.get_matter_attribute_value(clusters.FanControl.Attributes.SpeedMax) | ||
| ) |
TheJulianJES
reviewed
May 4, 2026
Member
TheJulianJES
left a comment
There was a problem hiding this comment.
What is the difference to this PR?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
PercentSetting(attribute0x0002) is a mandatory attribute of the Matter FanControl cluster, present on every fan that passes discovery — regardless of which optional features are advertised in theFeatureMap.Previously,
FanEntityFeature.SET_SPEEDwas only enabled when theMultiSpeedfeature bit was set, so fans withoutMultiSpeed(e.g. range hoods, HVAC fans) could not have their speed controlled by percentage.This PR moves
SET_SPEEDoutside thekMultiSpeedguard so that percentage-based speed control is always exposed, matching how Apple Home handles the same devices (it always writes toPercentSetting).When
kMultiSpeedis present,speed_countis still derived fromSpeedMax, giving the correct discrete step size. WithoutkMultiSpeed, HA defaults to 100 steps (1% granularity).Affected devices
Fans that previously only had preset-mode control and now also gain
SET_SPEED:Tests
Added
test_fan_set_percentage_without_multispeedto explicitly verify that a fan withFeatureMap = 0(noMultiSpeed) exposesSET_SPEED, reportspercentage_step = 1.0, and writes the correct value toPercentSettingwhenset_percentageis called.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: