Skip to content

Commit eb5199c

Browse files
authored
Merge pull request #2448 from SmartThingsCommunity/keep-supported-cap-table
Keep SUPPORTED_COMPONENT_CAPABILITIES table on driver
2 parents 7c63e8b + 0752c77 commit eb5199c

File tree

2 files changed

+8
-18
lines changed
  • drivers/SmartThings

2 files changed

+8
-18
lines changed

drivers/SmartThings/matter-sensor/src/air-quality-sensor/init.lua

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,10 @@ local function driver_switched(driver, device)
439439
end
440440

441441
local function device_init(driver, device)
442-
if device:get_field(SUPPORTED_COMPONENT_CAPABILITIES) then
443-
if version.api >= 15 and version.rpc >= 9 then
444-
-- the device used this modular profile workaround on 0.57 FW but no longer requires this table with >=0.58 FW
445-
device:set_field(SUPPORTED_COMPONENT_CAPABILITIES, nil)
446-
else
447-
-- assume that device is using a modular profile on 0.57 FW, override supports_capability_by_id
448-
-- library function to utilize optional capabilities
449-
device:extend_device("supports_capability_by_id", supports_capability_by_id_modular)
450-
end
442+
if device:get_field(SUPPORTED_COMPONENT_CAPABILITIES) and (version.api < 15 or version.rpc < 9) then
443+
-- assume that device is using a modular profile on 0.57 FW, override supports_capability_by_id
444+
-- library function to utilize optional capabilities
445+
device:extend_device("supports_capability_by_id", supports_capability_by_id_modular)
451446
end
452447
device:subscribe()
453448
end

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,10 @@ local endpoint_to_component = function (device, endpoint_id)
431431
end
432432

433433
local function device_init(driver, device)
434-
if device:get_field(SUPPORTED_COMPONENT_CAPABILITIES) then
435-
if version.api >= 15 and version.rpc >= 9 then
436-
-- the device used this modular profile workaround on 0.57 FW but no longer requires this table with >=0.58 FW
437-
device:set_field(SUPPORTED_COMPONENT_CAPABILITIES, nil)
438-
else
439-
-- assume that device is using a modular profile on 0.57 FW, override supports_capability_by_id
440-
-- library function to utilize optional capabilities
441-
device:extend_device("supports_capability_by_id", supports_capability_by_id_modular)
442-
end
434+
if device:get_field(SUPPORTED_COMPONENT_CAPABILITIES) and (version.api < 15 or version.rpc < 9) then
435+
-- assume that device is using a modular profile on 0.57 FW, override supports_capability_by_id
436+
-- library function to utilize optional capabilities
437+
device:extend_device("supports_capability_by_id", supports_capability_by_id_modular)
443438
end
444439
device:subscribe()
445440
device:set_component_to_endpoint_fn(component_to_endpoint)

0 commit comments

Comments
 (0)