File tree Expand file tree Collapse file tree 2 files changed +8
-18
lines changed
matter-sensor/src/air-quality-sensor Expand file tree Collapse file tree 2 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -439,15 +439,10 @@ local function driver_switched(driver, device)
439439end
440440
441441local 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 ()
453448end
Original file line number Diff line number Diff line change @@ -431,15 +431,10 @@ local endpoint_to_component = function (device, endpoint_id)
431431end
432432
433433local 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 )
You can’t perform that action at this time.
0 commit comments