Matter Switch: update subscribe logic#2667
Conversation
|
Channel deleted. |
Test Results 71 files 480 suites 0s ⏱️ Results for commit 3de35fd. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 3de35fd |
cjswedes
left a comment
There was a problem hiding this comment.
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) |
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.
Why is this no longer expected?
There was a problem hiding this comment.
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.
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
8f71143 to
79cea27
Compare
79cea27 to
3de35fd
Compare
Description of Change
Override generic matter switch handling of device:subscribe() to more properly and generically handle child devices.
Summary of Completed Tests
Tested multiple parent/child devices where the children had unique subscriptions from the parent device.