-
Notifications
You must be signed in to change notification settings - Fork 521
Matter Switch: update subscribe logic #2667
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
base: main
Are you sure you want to change the base?
Conversation
|
Invitation URL: |
Test Results 71 files 480 suites 0s ⏱️ Results for commit 1972787. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 1972787 |
cjswedes
left a comment
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.
Some of the test changes need a bit of explanation, but otherwise LGTM.
| -- @param matter_elements_seen table a list of attribute and event ids that have been added already | ||
| --- @param subscribed_attributes table key-value pairs mapping capability ids to subscribed attributes | ||
| --- @param subscribed_events table key-value pairs mapping capability ids to subscribed events | ||
| function utils.populate_subscribe_request_for_device(checked_device, subscribe_request, capabilities_seen, attributes_seen, events_seen, subscribed_attributes, subscribed_events) |
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.
Nice impl!
drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua
Outdated
Show resolved
Hide resolved
| test.socket.device_lifecycle:__queue_receive(unsup_mock_device:generate_info_changed({ profile = updated_device_profile })) | ||
|
|
||
| local cluster_subscribe_list = { | ||
| -- clusters.OnOff.attributes.OnOff, |
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.
Why is this no longer expected?
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 is no longer expected because now, the subscription is based on the capability->attribute/event maps for devices that currently exist.
Before, we were doing a device type check on all endpoints, which was catching that this device would need to subscribe to onOff eventually, when its child device was created. Now that logic has been pushed to when the child device is actually created (which is not now). Thus the attribute is no longer subscribed to at this point
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.
Also, I reworked this file a bit to get the structure tested more thoroughly by only initializing the mock_child in the tests where it's directly needed. This way, I showed that before the device is created, only some of the subscriptions are handled, but after the device is initialized, the more complete subscribe table is used.
drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/utils.lua
Show resolved
Hide resolved
ddaf944 to
1972787
Compare
Description of Change
Override generic matter switch handling of device:subscribe() to more properly and generically handle child devices.
Summary of Completed Tests