Skip to content

Matter Switch/Camera: Remove Unique Camera Lifecycle Handlers#2898

Open
hcarter-775 wants to merge 1 commit intomainfrom
remove/camera-lifecycle-2
Open

Matter Switch/Camera: Remove Unique Camera Lifecycle Handlers#2898
hcarter-775 wants to merge 1 commit intomainfrom
remove/camera-lifecycle-2

Conversation

@hcarter-775
Copy link
Copy Markdown
Contributor

@hcarter-775 hcarter-775 commented Apr 13, 2026

Description of Change

Primarily, this PR removes the camera subdriver lifecycle events in order to create more cohesive device configuration steps within the Matter Switch driver. It does this by using the main driver util functions where appropriate and by integrating a new step into the Matter Switch-specific subscribe function, where the function reads a "subscriptions.lua" file for sub-driver specific information.

  • As a part of this, work from this PR was included to avoid a double init for post-58 FW versions. Almost all test files were edited to comply with this update.
  • Also, the "avoid bridge" logic in device profiling that was introduced here has been re-worked. The original case described in the above commit has now been taken care of naturally, though with the introduction of new devices in Matter Switch like buttons and water valves, we still are returning early if the default endpoint found is of the aggregator type, after the child on/off devices are created.

As a secondary piece, it rewrites the Matter Camera integration tests. These tests were originally handled in a single file that took a very long time (at least for drivers) to run, and duplicated many parts of tests. I therefore broke it into two parts- one that handles device configuration logic, and the other that handles the attribute/event/capability handlers, which is not likely to change.

It also re-works some helper functions and helper systems to hopefully be more clear/concise.

Summary of Completed Tests

Tested with a series of spot-checks for common device types:

  • Extended color light did not re-profile, as expected
  • Binary light re-profiled, as expected
  • Matter Bridge did not re-profile, as expected

@hcarter-775 hcarter-775 changed the title Remove/camera lifecycle 2 Matter Switch/Camera: Remove Unique Camera Lifecycle Handler Apr 13, 2026
@github-actions
Copy link
Copy Markdown

Duplicate profile check: Passed - no duplicate profiles detected.

@hcarter-775 hcarter-775 changed the title Matter Switch/Camera: Remove Unique Camera Lifecycle Handler Matter Switch/Camera: Remove Unique Camera Lifecycle Handlers Apr 13, 2026
@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

Test Results

   72 files    503 suites   0s ⏱️
2 761 tests 2 761 ✅ 0 💤 0 ❌
4 658 runs  4 658 ✅ 0 💤 0 ❌

Results for commit 4a34bf2.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 13, 2026

File Coverage
All files 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/ikea_scroll/init.lua 89%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/subscriptions.lua 98%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/utils.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_utils/device_configuration.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/utils.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_utils/embedded_cluster_utils.lua 38%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua 83%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/capability_handlers.lua 90%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/switch_handlers/event_handlers.lua 97%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/ikea_scroll/scroll_handlers/event_handlers.lua 93%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/aqara_cube/init.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/capability_handlers.lua 82%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/camera/camera_handlers/attribute_handlers.lua 96%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/eve_energy/init.lua 91%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/sub_drivers/third_reality_mk1/init.lua 95%
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-switch/src/init.lua 97%

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 4a34bf2

},
}
end
if CameraUtils.feature_supported(device, clusters.CameraAvStreamManagement.ID, clusters.CameraAvStreamManagement.types.Feature.VIDEO) then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really VIDEO or is it SPEAKER?

clusters.CameraAvStreamManagement.types.Feature.SPEAKER)

@@ -0,0 +1,106 @@
-- Copyright © 2026 SmartThings, Inc.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a missing features of our Lua Libraries that sub drivers cannot provide/update a subscription map. I think we could address this in the lua libs by keeping the same "subscribed_attributes" field that is used in the parent driver, but we could just include the subdriver's attribute table as a part of the considered attributes in the populate_subscribed_attributes_from_driver_defaults function . I think you should be able to repurpose the code you've used below for aggregating the sub driver subscriptions.

This can solution here can be a short term solution, but if the goal of this is to provide a long term solution for sub drivers to provide unique subscriptions, then I think we should make that change in the lua libs themselves in order to keep the structure of sub drivers similar to those of the parent drivers.

Base automatically changed from matter-cam/re-init-feature-change to main April 14, 2026 19:09
@hcarter-775 hcarter-775 force-pushed the remove/camera-lifecycle-2 branch from 1e00f84 to 4a34bf2 Compare April 14, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants