From c1c2c3a6b254cb4f5b25d86f2d93648c051cb713 Mon Sep 17 00:00:00 2001 From: "Jan Jakubiszyn/SmartThings Integrations (BJ.jakubiszynS) /SRPOL/Engineer/Samsung Electronics" Date: Fri, 14 Nov 2025 16:56:08 +0100 Subject: [PATCH 1/4] Added support for Bosch matter motion sensor # Conflicts: # drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua # drivers/SmartThings/matter-switch/src/switch_utils/fields.lua --- .../matter-switch/fingerprints.yml | 5 ++++ ...-level-motion-illuminance-battery-temp.yml | 29 +++++++++++++++++++ .../matter-switch/src/switch_utils/fields.lua | 3 ++ 3 files changed, 37 insertions(+) create mode 100644 drivers/SmartThings/matter-switch/profiles/light-level-motion-illuminance-battery-temp.yml diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index 5e65aa24fe..edfc320882 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -167,6 +167,11 @@ matterManufacturer: vendorId: 0x1209 productId: 0x3016 deviceProfileName: plug-power-energy-powerConsumption + - id: 4617/12307 + deviceLabel: "Motion Detector II [+M]" + vendorId: 0x1209 + productId: 0x3013 + deviceProfileName: light-level-motion-illuminance-battery-temp #Chengdu - id: "5218/8197" deviceLabel: Magic Cube DS001 diff --git a/drivers/SmartThings/matter-switch/profiles/light-level-motion-illuminance-battery-temp.yml b/drivers/SmartThings/matter-switch/profiles/light-level-motion-illuminance-battery-temp.yml new file mode 100644 index 0000000000..ae116ed54d --- /dev/null +++ b/drivers/SmartThings/matter-switch/profiles/light-level-motion-illuminance-battery-temp.yml @@ -0,0 +1,29 @@ +name: light-level-motion-illuminance-battery-temp +components: + - id: main + capabilities: + - id: motionSensor + version: 1 + - id: temperatureMeasurement + version: 1 + - id: illuminanceMeasurement + version: 1 + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + - id: switch + version: 1 + - id: switchLevel + version: 1 + config: + values: + - key: "level.value" + range: [1, 100] + categories: + - name: MotionSensor +preferences: + - preferenceId: tempOffset + explicit: true \ No newline at end of file diff --git a/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua b/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua index f0fd0166b4..3cecc45c59 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua @@ -116,6 +116,9 @@ SwitchFields.vendor_overrides = { [0x117C] = { -- IKEA_MANUFACTURER_ID [0x8000] = { is_ikea_scroll = true } }, + [0x1209] = { -- Bosch + [0x3013] = {target_profile = "light-level-motion-illuminance-battery-temp"} + } } SwitchFields.switch_category_vendor_overrides = { From 09697bbbd6c41dbbef9482d7829e19a64e029325 Mon Sep 17 00:00:00 2001 From: "Jan Jakubiszyn/SmartThings Integrations (BJ.jakubiszynS) /SRPOL/Engineer/Samsung Electronics" Date: Thu, 27 Nov 2025 15:46:08 +0100 Subject: [PATCH 2/4] Implementing changes from the code review: edit of the device profile name and capability order, edit of the match_profile's condition --- drivers/SmartThings/matter-switch/fingerprints.yml | 2 +- ...vel-battery-illuminance-motion-temperature.yml} | 14 +++++++------- .../src/switch_utils/device_configuration.lua | 2 +- .../matter-switch/src/switch_utils/fields.lua | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) rename drivers/SmartThings/matter-switch/profiles/{light-level-motion-illuminance-battery-temp.yml => light-level-battery-illuminance-motion-temperature.yml} (91%) diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index edfc320882..f09de5aa6e 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -171,7 +171,7 @@ matterManufacturer: deviceLabel: "Motion Detector II [+M]" vendorId: 0x1209 productId: 0x3013 - deviceProfileName: light-level-motion-illuminance-battery-temp + deviceProfileName: light-level-battery-illuminance-motion-temperature #Chengdu - id: "5218/8197" deviceLabel: Magic Cube DS001 diff --git a/drivers/SmartThings/matter-switch/profiles/light-level-motion-illuminance-battery-temp.yml b/drivers/SmartThings/matter-switch/profiles/light-level-battery-illuminance-motion-temperature.yml similarity index 91% rename from drivers/SmartThings/matter-switch/profiles/light-level-motion-illuminance-battery-temp.yml rename to drivers/SmartThings/matter-switch/profiles/light-level-battery-illuminance-motion-temperature.yml index ae116ed54d..1748d311f2 100644 --- a/drivers/SmartThings/matter-switch/profiles/light-level-motion-illuminance-battery-temp.yml +++ b/drivers/SmartThings/matter-switch/profiles/light-level-battery-illuminance-motion-temperature.yml @@ -1,4 +1,4 @@ -name: light-level-motion-illuminance-battery-temp +name: light-level-battery-illuminance-motion-temperature components: - id: main capabilities: @@ -8,12 +8,6 @@ components: version: 1 - id: illuminanceMeasurement version: 1 - - id: battery - version: 1 - - id: firmwareUpdate - version: 1 - - id: refresh - version: 1 - id: switch version: 1 - id: switchLevel @@ -22,6 +16,12 @@ components: values: - key: "level.value" range: [1, 100] + - id: battery + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 categories: - name: MotionSensor preferences: diff --git a/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua b/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua index 750c9eb50c..b089d29ced 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua @@ -193,7 +193,7 @@ function DeviceConfiguration.match_profile(driver, device) if generic_profile("light-color-level") and #device:get_endpoints(clusters.FanControl.ID) > 0 then updated_profile = "light-color-level-fan" elseif generic_profile("light-level") and #device:get_endpoints(clusters.OccupancySensing.ID) > 0 then - updated_profile = "light-level-motion" + updated_profile = switch_utils.get_product_override_field(device, "target_profile") or "light-level-motion" elseif generic_profile("plug-binary") or generic_profile("plug-level") then if switch_utils.check_switch_category_vendor_overrides(device) then updated_profile = string.gsub(updated_profile, "plug", "switch") diff --git a/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua b/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua index 3cecc45c59..905b0ca36a 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/fields.lua @@ -117,7 +117,7 @@ SwitchFields.vendor_overrides = { [0x8000] = { is_ikea_scroll = true } }, [0x1209] = { -- Bosch - [0x3013] = {target_profile = "light-level-motion-illuminance-battery-temp"} + [0x3013] = {target_profile = "light-level-battery-illuminance-motion-temperature"} } } From 98408c70516f4df60c7e236ecf204107f38d4e51 Mon Sep 17 00:00:00 2001 From: "Jan Jakubiszyn/SmartThings Integrations (BJ.jakubiszynS) /SRPOL/Engineer/Samsung Electronics" Date: Fri, 19 Dec 2025 16:20:20 +0100 Subject: [PATCH 3/4] Improvement of the temp offset update by addng refresh after info_changed and setting default dimmer value of the device to 100% after on command is triggered --- drivers/SmartThings/matter-switch/src/init.lua | 1 + .../matter-switch/src/switch_utils/device_configuration.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/SmartThings/matter-switch/src/init.lua b/drivers/SmartThings/matter-switch/src/init.lua index 5436d57baf..b61c660ccc 100644 --- a/drivers/SmartThings/matter-switch/src/init.lua +++ b/drivers/SmartThings/matter-switch/src/init.lua @@ -66,6 +66,7 @@ function SwitchLifecycleHandlers.info_changed(driver, device, event, args) button_cfg.configure_buttons(device) end end + device:refresh() end function SwitchLifecycleHandlers.device_removed(driver, device) diff --git a/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua b/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua index b089d29ced..cf26208849 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua @@ -77,6 +77,7 @@ function SwitchDeviceConfiguration.set_device_control_options(device) -- before the Matter 1.3 lua libs update (HUB FW 54), OptionsBitmap was defined as LevelControlOptions if switch_utils.find_cluster_on_ep(ep, clusters.LevelControl.ID) then device:send(clusters.LevelControl.attributes.Options:write(device, ep.endpoint_id, clusters.LevelControl.types.LevelControlOptions.EXECUTE_IF_OFF)) + device:send(clusters.LevelControl.attributes.OnLevel:write(device, ep.endpoint_id, 254)) end -- before the Matter 1.4 lua libs update (HUB FW 56), there was no OptionsBitmap type defined if switch_utils.find_cluster_on_ep(ep, clusters.ColorControl.ID) then From 352509c21deb6e3da42ad197df8d4444b64344cc Mon Sep 17 00:00:00 2001 From: "Jan Jakubiszyn/SmartThings Integrations (BJ.jakubiszynS) /SRPOL/Engineer/Samsung Electronics" Date: Fri, 19 Dec 2025 16:42:52 +0100 Subject: [PATCH 4/4] Fixing unit tests in test_matter_switch --- .../matter-switch/src/test/test_matter_switch.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua index e38003ce5a..085ad3a341 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_switch.lua @@ -212,6 +212,10 @@ local function test_init_color_temp() mock_device_color_temp.id, clusters.LevelControl.attributes.Options:write(mock_device_color_temp, 1, clusters.LevelControl.types.OptionsBitmap.EXECUTE_IF_OFF) }) + test.socket.matter:__expect_send({ + mock_device_color_temp.id, + clusters.LevelControl.attributes.OnLevel:write(mock_device_color_temp, 1, 254) + }) test.socket.matter:__expect_send({ mock_device_color_temp.id, clusters.ColorControl.attributes.Options:write(mock_device_color_temp, 1, clusters.ColorControl.types.OptionsBitmap.EXECUTE_IF_OFF) @@ -239,6 +243,10 @@ local function test_init_extended_color() mock_device_extended_color.id, clusters.LevelControl.attributes.Options:write(mock_device_extended_color, 1, clusters.LevelControl.types.OptionsBitmap.EXECUTE_IF_OFF) }) + test.socket.matter:__expect_send({ + mock_device_extended_color.id, + clusters.LevelControl.attributes.OnLevel:write(mock_device_extended_color, 1,254) + }) test.socket.matter:__expect_send({ mock_device_extended_color.id, clusters.ColorControl.attributes.Options:write(mock_device_extended_color, 1, clusters.ColorControl.types.OptionsBitmap.EXECUTE_IF_OFF)