Repository navigation
Matter Camera: Exclude audioVolume on unusable volume range - #3242
Conversation
|
Channel deleted. |
|
matter-switch_coverage.xml
Minimum allowed coverage is Generated by 🐒 cobertura-action against d29da26 |
Test Results 73 files 541 suites 0s ⏱️ Results for commit d29da26. ♻️ This comment has been updated with latest results. |
|
The equal min/max convention seems like a reasonable compatibility mechanism for devices whose hardware cannot provide adjustable gain/volume, and handling speaker and microphone independently makes sense. I noticed two cases that I think should be addressed. 1. Range discovery currently depends on
|
|
Good catch on both. For # 1: you're right, it wasn't actually decoupled. For # 2: the capability-inclusion check already treats |
|
Thanks! Both issues I raised are now addressed. Moving the range attributes into the One small remaining edge case: Other than that, the changes look good to me. |
|
@Ideora Good catch again, confirmed with a test. Once Added a guard: when the range is zero-width, it reports a fixed 0 instead of normalizing. Also checked the volume math in |
|
This has now been validated with a Matter camera that exposes unusable microphone range; the net effect is that the microphone setting is omitted from UI for that camera. I have updated the testing section of the PR to reflect that. |
| -- SpeakerMaxLevel/MinLevel and MicrophoneMaxLevel/MinLevel are subscribed alongside audioMute | ||
| -- (unconditional on the AUDIO/SPEAKER feature) rather than audioVolume, since audioVolume's own | ||
| -- presence in the profile depends on first discovering these values -- gating their subscription | ||
| -- on audioVolume already being present would make that discovery impossible. |
There was a problem hiding this comment.
I have a bit of work (kinda outdated but not too much I don't think) trying to solve this exact problem a little more clearly (that is, adding the ability to subscribe to attributes/events based on other values besides a capability.
There was a problem hiding this comment.
That looks neat! We can move to those conditional_subscriptions post this change (and once you rebase your work later).
Co-authored-by: Harrison Carter <harrison.carter@smartthings.com>
ctowns
left a comment
There was a problem hiding this comment.
LGTM! Thank you for adding the unit tests for the edge cases as well 🚀
| -- min == max is a valid (non-adjustable) range per the Matter spec, so only max < min is malformed; | ||
| -- an out-of-bounds value is clamped, but a malformed relationship is only logged and left as-is, | ||
| -- since volume_level_handler already guards against a non-positive range. |
There was a problem hiding this comment.
nit: remove comment? Seems unnecessary to mention this
There was a problem hiding this comment.
I personally think the comment is useful since it documents atypical behavior (min == max being allowed)
There was a problem hiding this comment.
Yeah, I think that part is fine. Mostly I was mentioning the extra stuff about only logging the malformed relationship, which is explicitly written in code just below. No strong feelings, but that is what I was primarily pointing out
| local max_volume = device:get_field(camera_fields.MAX_VOLUME_LEVEL .. "_" .. component) | ||
| if min_volume < camera_fields.ABS_VOL_MIN or (max_volume and min_volume >= max_volume) then | ||
| local max_volume = camera_utils.get_field_for_component(device, camera_fields.MAX_VOLUME_LEVEL, component) | ||
| -- See max_volume_level_handler: min == max is valid, only min > max is malformed and only logged. |
There was a problem hiding this comment.
same thing here about unnecessary comment
Description of Change
In Matter spec, there’s no specific feature-map based gating on microphone/speaker volume settings, outside of the larger Audio (ADO) feature i.e. any camera device supporting audio needs to implement these settings even if the hardware doesn’t support adjusting volume/gain for it. We have encountered one such camera and have confirmed with the partner that this setting cannot be implemented for their hardware.
Upon following up with Camera TT in CSA, it was noted as a miss that will be followed up separately (to either change the conformance of volume settings from
ADOto[ADO], or introduce a separate feature map bit for audio gain control) in the future versions of the spec. However to resolve issues in the field and currently available versions of the spec, we found a backward-compatible workaround (which was confirmed to be allowed per DM TT) where min and max can be set to the same value in the constraints defined for these attributes, and that can be keyed off by clients to determine that the volume range is unusable and therefore the capability can be excluded.Summary of Completed Tests