|
1 | | --- Copyright 2025 SmartThings |
2 | | --- |
3 | | --- Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | --- you may not use this file except in compliance with the License. |
5 | | --- You may obtain a copy of the License at |
6 | | --- |
7 | | --- http://www.apache.org/licenses/LICENSE-2.0 |
8 | | --- |
9 | | --- Unless required by applicable law or agreed to in writing, software |
10 | | --- distributed under the License is distributed on an "AS IS" BASIS, |
11 | | --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | --- See the License for the specific language governing permissions and |
13 | | --- limitations under the License. |
| 1 | +-- Copyright © 2025 SmartThings, Inc. |
| 2 | +-- Licensed under the Apache License, Version 2.0 |
14 | 3 |
|
15 | 4 | ------------------------------------------------------------------------------------- |
16 | 5 | -- Matter Camera Sub Driver |
@@ -160,25 +149,6 @@ local ABS_VOL_MAX, ABS_VOL_MIN = 254.0, 0.0 |
160 | 149 |
|
161 | 150 | -- Helper Functions |
162 | 151 |
|
163 | | -local function is_camera(opts, driver, device) |
164 | | - local device_lib = require "st.device" |
165 | | - if device.network_type == device_lib.NETWORK_TYPE_MATTER then |
166 | | - local version = require "version" |
167 | | - if version.rpc < 10 or version.api < 16 then |
168 | | - device.log.warn(string.format("Matter Camera not supported on current firmware version")) |
169 | | - return false |
170 | | - end |
171 | | - for _, ep in ipairs(device.endpoints) do |
172 | | - for _, dt in ipairs(ep.device_types) do |
173 | | - if dt.device_type_id == 0x0142 then -- 0x0142 is the Camera device type ID |
174 | | - return true |
175 | | - end |
176 | | - end |
177 | | - end |
178 | | - end |
179 | | - return false |
180 | | -end |
181 | | - |
182 | 152 | local function component_to_endpoint(device, component) |
183 | 153 | local camera_eps = device:get_endpoints(clusters.CameraAvStreamManagement.ID) |
184 | 154 | table.sort(camera_eps) |
@@ -621,7 +591,7 @@ local function device_init(driver, device) |
621 | 591 | local parent_child_device = false |
622 | 592 | for _, ep in ipairs(device.endpoints) do |
623 | 593 | if device:supports_server_cluster(clusters.OnOff.ID, ep.endpoint_id) then |
624 | | - local child_profile = cfg.SwitchCfg.assign_child_profile(device, ep.endpoint_id) |
| 594 | + local child_profile = cfg.SwitchCfg.assign_profile_for_onoff_ep(device, ep.endpoint_id) |
625 | 595 | if child_profile then |
626 | 596 | num_floodlight_eps = num_floodlight_eps + 1 |
627 | 597 | local name = string.format("%s %d", "Floodlight", num_floodlight_eps) |
@@ -1582,7 +1552,7 @@ local camera_handler = { |
1582 | 1552 | [capabilities.localMediaStorage.commands.setLocalVideoRecording.NAME] = set_enabled_factory(clusters.CameraAvStreamManagement.attributes.LocalVideoRecordingEnabled) |
1583 | 1553 | } |
1584 | 1554 | }, |
1585 | | - can_handle = is_camera |
| 1555 | + can_handle = require("sub_drivers.camera.can_handle") |
1586 | 1556 | } |
1587 | 1557 |
|
1588 | 1558 | return camera_handler |
0 commit comments