Skip to content

Commit 35d6719

Browse files
Update compare_components function name
1 parent 9efed63 commit 35d6719

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

drivers/SmartThings/matter-switch/src/sub_drivers/camera/init.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,22 @@ local function compute_fps(max_encoded_pixel_rate, width, height, max_fps)
209209
return math.tointeger(math.floor(fps / fps_step) * fps_step)
210210
end
211211

212-
local function compare_components(synced_components, prev_components)
212+
local function profile_changed(synced_components, prev_components)
213213
if #synced_components ~= #prev_components then
214-
return false
214+
return true
215215
end
216216
for _, component in pairs(synced_components) do
217217
if (prev_components[component.id] == nil) or
218218
(#component.capabilities ~= #prev_components[component.id].capabilities) then
219-
return false
219+
return true
220220
end
221221
for _, capability in pairs(component.capabilities) do
222222
if prev_components[component.id][capability.id] == nil then
223-
return false
223+
return true
224224
end
225225
end
226226
end
227-
return true
227+
return false
228228
end
229229

230230
local function optional_capabilities_list_changed(optional_capabilities, prev_component_list)
@@ -588,7 +588,7 @@ end
588588

589589
local function info_changed(driver, device, event, args)
590590
-- resubscribe and initialize relevant camera capabilities if a modular update has occurred
591-
if not compare_components(device.profile.components, args.old_st_store.profile.components) then
591+
if profile_changed(device.profile.components, args.old_st_store.profile.components) then
592592
initialize_camera_capabilities(device)
593593
add_camera_subscribed_attributes(device)
594594
device:subscribe()

drivers/SmartThings/matter-switch/src/switch_utils/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
-- Copyright © 2025 SmartThings, Inc.
22
-- Licensed under the Apache License, Version 2.0
33

4+
local MatterDriver = require "st.matter.driver"
45
local fields = require "switch_utils.fields"
56
local st_utils = require "st.utils"
67
local clusters = require "st.matter.clusters"
78
local capabilities = require "st.capabilities"
89
local log = require "log"
10+
local version = require "version"
911

1012
local utils = {}
1113

@@ -269,8 +271,6 @@ function utils.report_power_consumption_to_st_energy(device, latest_total_import
269271
end
270272

271273
function utils.lazy_load_if_possible(sub_driver_name)
272-
local MatterDriver = require "st.matter.driver"
273-
local version = require "version"
274274
if version.api >= 16 then
275275
return MatterDriver.lazy_load_sub_driver_v2(sub_driver_name)
276276
elseif version.api >= 9 then

0 commit comments

Comments
 (0)