Skip to content

Commit 9fa6434

Browse files
Lazy load camera subdriver only for LuaLibs 16 and greater (#2558)
The camera subdriver is only supported on LuaLibs version >= 16, and causes issues if it's loaded on previous versions, so this commit changes `lazy_load_if_possible` to `lazy_load`, which only attempts to pull in the subdriver if the api version if 16 or greater.
1 parent 4bce0f3 commit 9fa6434

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ local matter_driver_template = {
297297
supported_capabilities = fields.supported_capabilities,
298298
sub_drivers = {
299299
require("sub_drivers.aqara_cube"),
300-
switch_utils.lazy_load_if_possible("sub_drivers.camera"),
300+
switch_utils.lazy_load("sub_drivers.camera"),
301301
require("sub_drivers.eve_energy"),
302302
require("sub_drivers.third_reality_mk1")
303303
}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,9 @@ function utils.report_power_consumption_to_st_energy(device, latest_total_import
344344
end
345345
end
346346

347-
function utils.lazy_load_if_possible(sub_driver_name)
347+
function utils.lazy_load(sub_driver_name)
348348
if version.api >= 16 then
349349
return MatterDriver.lazy_load_sub_driver_v2(sub_driver_name)
350-
elseif version.api >= 9 then
351-
return MatterDriver.lazy_load_sub_driver(require(sub_driver_name))
352-
else
353-
return require(sub_driver_name)
354350
end
355351
end
356352

0 commit comments

Comments
 (0)