Fix Matter Door Lock Operating Mode select entity#158468
Conversation
|
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
|
… update tests for supported modes
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where the Matter Door Lock Operating Mode selector was showing all 5 operating modes regardless of device capabilities. The solution implements bitmap-based filtering using the Matter specification's SupportedOperatingModes attribute, where bit=0 indicates a supported mode and bit=1 indicates unsupported.
Key changes:
- Created specialized
MatterDoorLockOperatingModeSelectEntityclass that reads and interprets theSupportedOperatingModesbitmap - Changed discovery schema to use
MatterMapSelectEntityDescriptionwith bitmap attribute support - Updated tests to verify bitmap-based filtering and only test with supported operating modes
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
homeassistant/components/matter/select.py |
Implements new MatterDoorLockOperatingModeSelectEntity class with bitmap interpretation logic and updates discovery schema to require SupportedOperatingModes attribute |
tests/components/matter/test_select.py |
Updates test to verify bitmap-based filtering works correctly with fixture that has bits 0, 2, and 3 cleared (Normal, Privacy, NoRemoteLockUnlock supported) |
tests/components/matter/snapshots/test_select.ambr |
Updates snapshots to reflect filtered options based on each fixture's bitmap values instead of showing all 5 modes |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Matterwise LGTM, and yes matter spec has this strange "reversed" bitmap :-) |
Could you approve it if it seems OK? |
Added assertion to verify initial state is in allowed options.
TheJulianJES
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks!
Proposed change
Problem: The Door Lock Operating Mode selector was including all 5 operating modes unconditionally, but the Matter specification uses a bitmap attribute (
SupportedOperatingModes) to indicate which modes a device actually supports.Solution: Created a specialized
MatterDoorLockOperatingModeSelectEntityclass that:SupportedOperatingModesbitmap from the deviceDOOR_LOCK_OPERATING_MODE_MAPfor all possible translationsKey Features:
SupportedOperatingModes Attribute
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: