-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi-button support for matter button devices. #849
Conversation
Duplicate profile check: Passed - no duplicate profiles detected. |
Channel deleted. |
So this works by either using multi-component for a device for which we have a profile with that number of buttons defined or it uses parent child for cases where we don't. If people think we should add more than just 2,4,8 let me know. Also thoughts on distinguishing battery vs. non-battery, or just assuming we have battery in all cases? |
Test Results 52 files ± 0 339 suites +1 0s ⏱️ ±0s Results for commit 7960872. ± Comparison against base commit 330ba0a. This pull request removes 3 and adds 9 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against 7960872 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! The event handling for presses seems very solid wrt the various cluster feature support.
I know there will be some button devices that don't have battery so it'd be best to support both |
I did some testing with the Tuo Smart Button and this driver and the device is far more functional and single press, held seemed to work correctly. Double-press does seem to register but the driver is also emitting single-press events for the multi-press case. Here's logs from a double-press from the driver at 6ff3af1.
|
@posborne was that from a new install or a driver switch? |
I driver switched to my self-published off this branch but I can retest with a fresh join. |
@posborne I expect better results off of a fresh join. A lot of the interrogation work and setting of important state happens in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly suspect we'll be revisiting this code a few times in the near future but this is significantly improved over the current base in tree and changes overall LGTM.
re-order type handling so that multi-press buttons have priority keep newly-created components and devices around in a map to avoid race conditions updating device storage avoid race condition when switching profile change multi buttons to support held events
1c98aae
to
7960872
Compare
set_field_for_endpoint(device, MULTI_BUTTON, ep, true, true) | ||
supportedButtonValues_event = nil -- deferred until max press handler | ||
elseif contains(MSL, ep) then | ||
device.log.debug("configuring for long press device") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this case is missing some logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I said that because my 4-button device supports press/hold and isn't working, but on further review it's not clear to me if the issue is here or somewhere else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it also support Multipress or just Press & Hold?
Did you try to re-add the device?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not support multipress. I removed/re-added a few times and the behavior was same each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is some more testing we need to do with multi-button devices, but I think this is a good improvement over what we have now and would suggest we merge this sooner than later to get these fixes out to everyone.
No description provided.