From f44090f78ed5bcc47af03aff1578d31b31a96bd0 Mon Sep 17 00:00:00 2001 From: Cooper Towns Date: Mon, 2 Dec 2024 18:09:58 -0600 Subject: [PATCH 01/23] Matter Thermostat: check for nil in temp attribute handler --- drivers/SmartThings/matter-thermostat/src/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/SmartThings/matter-thermostat/src/init.lua b/drivers/SmartThings/matter-thermostat/src/init.lua index 5143f4dfd0..5571326297 100644 --- a/drivers/SmartThings/matter-thermostat/src/init.lua +++ b/drivers/SmartThings/matter-thermostat/src/init.lua @@ -720,6 +720,9 @@ end local function temp_event_handler(attribute) return function(driver, device, ib, response) + if ib.data.value == nil then + return + end local unit = "C" -- Only emit the capability for RPC version >= 5, since unit conversion for From 46bff8d53cac8d9448ef9b641366ebac998e3cbc Mon Sep 17 00:00:00 2001 From: SiHAS <71238736+shinasys@users.noreply.github.com> Date: Tue, 3 Dec 2024 12:43:36 +0900 Subject: [PATCH 02/23] Add shinasystem's full buttons switch for wwst (#1748) - SQM300Z4, SQM300Z6 --- drivers/SmartThings/zigbee-switch/fingerprints.yml | 10 ++++++++++ .../zigbee-switch/src/multi-switch-no-master/init.lua | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/SmartThings/zigbee-switch/fingerprints.yml b/drivers/SmartThings/zigbee-switch/fingerprints.yml index ffd5c26971..bedbc33b91 100644 --- a/drivers/SmartThings/zigbee-switch/fingerprints.yml +++ b/drivers/SmartThings/zigbee-switch/fingerprints.yml @@ -1120,6 +1120,16 @@ zigbeeManufacturer: manufacturer: ShinaSystem model: SQM300Z3 deviceProfileName: basic-switch + - id: ShinaSystem/SQM300Z4 + deviceLabel: SiHAS Switch 1 + manufacturer: ShinaSystem + model: SQM300Z4 + deviceProfileName: basic-switch + - id: ShinaSystem/SQM300Z6 + deviceLabel: SiHAS Switch 1 + manufacturer: ShinaSystem + model: SQM300Z6 + deviceProfileName: basic-switch - id: Samsung/SAMSUNG-ITM-Z-002 deviceLabel: Samsung Light manufacturer: Samsung Electronics diff --git a/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua b/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua index 98317c0e73..e39be7593f 100644 --- a/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/multi-switch-no-master/init.lua @@ -48,6 +48,8 @@ local MULTI_SWITCH_NO_MASTER_FINGERPRINTS = { { mfr = "ShinaSystem", model = "SBM300Z6", children = 5 }, { mfr = "ShinaSystem", model = "SQM300Z2", children = 1 }, { mfr = "ShinaSystem", model = "SQM300Z3", children = 2 }, + { mfr = "ShinaSystem", model = "SQM300Z4", children = 3 }, + { mfr = "ShinaSystem", model = "SQM300Z6", children = 5 }, { model = "E220-KR2N0Z0-HA", children = 1 }, { model = "E220-KR3N0Z0-HA", children = 2 }, { model = "E220-KR4N0Z0-HA", children = 3 }, From ff3a213cd134b0ec0de879a8aa75e4da62aaeb81 Mon Sep 17 00:00:00 2001 From: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:00:49 -0500 Subject: [PATCH 03/23] New Device (Matter Switch) Cync Reveal Full Color A21 (#1788) * new-device-cync-A21 * Update device label to A21 * Update decimal number for "id:" --- drivers/SmartThings/matter-switch/fingerprints.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index c1b57ecf8b..ca1e21831d 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -165,6 +165,11 @@ matterManufacturer: vendorId: 0x1339 productId: 0x007B deviceProfileName: light-color-level-2000K-7000K + - id: "4921/109" + deviceLabel: Cync Reveal Full Color A21 + vendorId: 0x1339 + productId: 0x006D + deviceProfileName: light-color-level-2000K-7000K - id: "4921/111" deviceLabel: Cync Outdoor Plug vendorId: 0x1339 From e355080ba1f3cb108145f812e197c38000aa8cab Mon Sep 17 00:00:00 2001 From: FrankSpringfield Date: Wed, 4 Dec 2024 23:12:39 +0800 Subject: [PATCH 04/23] Add fingerprints for TOTEM S50V/S93/W31V and sort fingerprints for TOTEM alphabetically (#1775) * Add fingerprints for TOTEM S50V/S93/W31V Signed-off-by: frank-huang * Sort fingerprints for TOTEM alphabetically Signed-off-by: frank-huang --------- Signed-off-by: frank-huang --- .../SmartThings/zigbee-lock/fingerprints.yml | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/SmartThings/zigbee-lock/fingerprints.yml b/drivers/SmartThings/zigbee-lock/fingerprints.yml index aa93618497..00e8dd0f51 100644 --- a/drivers/SmartThings/zigbee-lock/fingerprints.yml +++ b/drivers/SmartThings/zigbee-lock/fingerprints.yml @@ -145,6 +145,16 @@ zigbeeManufacturer: manufacturer: TOTEM model: P30 deviceProfileName: lock-battery + - id: TOTEM/P70 + deviceLabel: TOTEM Door Lock + manufacturer: TOTEM + model: P70 + deviceProfileName: lock-battery + - id: TOTEM/P90 + deviceLabel: TOTEM Door Lock + manufacturer: TOTEM + model: P90 + deviceProfileName: lock-battery - id: TOTEM/Q30 deviceLabel: TOTEM Door Lock manufacturer: TOTEM @@ -165,15 +175,20 @@ zigbeeManufacturer: manufacturer: TOTEM model: R71 deviceProfileName: lock-battery - - id: TOTEM/P70 + - id: TOTEM/S50V deviceLabel: TOTEM Door Lock manufacturer: TOTEM - model: P70 + model: S50V deviceProfileName: lock-battery - - id: TOTEM/P90 + - id: TOTEM/S93 deviceLabel: TOTEM Door Lock manufacturer: TOTEM - model: P90 + model: S93 + deviceProfileName: lock-battery + - id: TOTEM/W31V + deviceLabel: TOTEM Door Lock + manufacturer: TOTEM + model: W31V deviceProfileName: lock-battery zigbeeGeneric: - id: "genericLock" From f10d8b16639c55ac7dc5e571d03cbc25b0ede8d7 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Wed, 4 Dec 2024 11:00:10 -0800 Subject: [PATCH 05/23] Fix for virtual switch regression There have been some issues getting this fully deployed, so this changes the behavior to default to the old behavior in case the preference is missing. --- .../SmartThings/virtual-switch/src/init.lua | 6 +++-- .../src/test/test_virtual_switch.lua | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/SmartThings/virtual-switch/src/init.lua b/drivers/SmartThings/virtual-switch/src/init.lua index 116427a6ad..7f5288a9c4 100644 --- a/drivers/SmartThings/virtual-switch/src/init.lua +++ b/drivers/SmartThings/virtual-switch/src/init.lua @@ -2,10 +2,12 @@ local capabilities = require "st.capabilities" local Driver = require "st.driver" local function force_state_change(device) - if device.preferences["certifiedpreferences.forceStateChange"] then + if device.preferences == nil or device.preferences["certifiedpreferences.forceStateChange"] == nil then return {state_change = true} - else + elseif not device.preferences["certifiedpreferences.forceStateChange"] then return nil + else + return {state_change = true} end end diff --git a/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua b/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua index a42dfc4a1f..651668297b 100644 --- a/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua +++ b/drivers/SmartThings/virtual-switch/src/test/test_virtual_switch.lua @@ -10,8 +10,15 @@ local mock_simple_device = test.mock_device.build_test_generic_device( } ) +local mock_device_no_prefs = test.mock_device.build_test_generic_device( + { + profile = t_utils.get_profile_definition("virtual-dimmer-switch.yml"), + } +) + local function test_init() test.mock_device.add_test_device(mock_simple_device) + test.mock_device.add_test_device(mock_device_no_prefs) end test.set_test_init_function(test_init) @@ -53,6 +60,22 @@ test.register_message_test( } ) +test.register_message_test( + "Reported on off status should be handled: on", + { + { + channel = "capability", + direction = "receive", + message = { mock_device_no_prefs.id, { capability = "switch", component = "main", command = "on", args = {}}} + }, + { + channel = "capability", + direction = "send", + message = mock_device_no_prefs:generate_test_message("main", capabilities.switch.switch.on({state_change=true})) + } + } +) + test.register_message_test( "Reported on off status should be handled: off", { From 76da639b204f17a414f65c3eb87f31b4c3856773 Mon Sep 17 00:00:00 2001 From: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:23:18 -0500 Subject: [PATCH 06/23] New Devices (Matter Switch + Matter Sensor) 1 Heiman Co Sensor and 2 Zemismart Devices (#1794) * new-devices-Zemismart-Heiman * Adding fingerprint --- drivers/SmartThings/matter-sensor/fingerprints.yml | 5 +++++ drivers/SmartThings/matter-switch/fingerprints.yml | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/SmartThings/matter-sensor/fingerprints.yml b/drivers/SmartThings/matter-sensor/fingerprints.yml index b270332b6d..7e4a3ae4b6 100644 --- a/drivers/SmartThings/matter-sensor/fingerprints.yml +++ b/drivers/SmartThings/matter-sensor/fingerprints.yml @@ -58,6 +58,11 @@ matterManufacturer: vendorId: 0x120B productId: 0x1003 deviceProfileName: smoke + - id: "4619/4103" + deviceLabel: Smart co sensor + vendorId: 0x120B + productId: 0x1007 + deviceProfileName: co # Legrand - id: "Legrand/Netatmo/Smart-2-in-1-Sensor" deviceLabel: Netatmo Smart 2-in-1 Sensor diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index ca1e21831d..1dd9b85c53 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -2359,6 +2359,11 @@ matterManufacturer: vendorId: 0x139C productId: 0xD003 deviceProfileName: light-color-level + - id: "5020/43784" + deviceLabel: Zemismart WiFi Smart Switch + vendorId: 0x139C + productId: 0xAB08 + deviceProfileName: switch-binary - id: "5020/43825" deviceLabel: Zemismart WiFi Smart Switch vendorId: 0x139C @@ -2374,6 +2379,11 @@ matterManufacturer: vendorId: 0x139C productId: 0xAB01 deviceProfileName: switch-binary + - id: "5020/43843" + deviceLabel: Zemismart WiFi Smart Switch + vendorId: 0x139C + productId: 0xAB43 + deviceProfileName: switch-binary #TUO - id: "5150/1" deviceLabel: "TUO Smart Button" From 08aecf36f092d695d2c2c2990cbee7ab1e8ef5fd Mon Sep 17 00:00:00 2001 From: hdlee27 <54927573+hdlee27@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:04:25 +0900 Subject: [PATCH 07/23] fp2: copy additional header (#1793) Signed-off-by: hdlee27 <54927573+hdlee27@users.noreply.github.com> --- drivers/Aqara/aqara-presence-sensor/src/fp2/api.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/Aqara/aqara-presence-sensor/src/fp2/api.lua b/drivers/Aqara/aqara-presence-sensor/src/fp2/api.lua index 4f27a277a3..e6c620be3f 100644 --- a/drivers/Aqara/aqara-presence-sensor/src/fp2/api.lua +++ b/drivers/Aqara/aqara-presence-sensor/src/fp2/api.lua @@ -2,6 +2,7 @@ local log = require "log" local json = require "st.json" local RestClient = require "lunchbox.rest" local utils = require "utils" +local st_utils = require "st.utils" local fp2_api = {} fp2_api.__index = fp2_api @@ -48,7 +49,7 @@ function fp2_api.new_device_manager(device_ip, bridge_info, socket_builder) return setmetatable( { - headers = ADDITIONAL_HEADERS, + headers = st_utils.deep_copy(ADDITIONAL_HEADERS), socket_builder = socket_builder, base_url = base_url, }, fp2_api From c5b1b7dc17516499955cbe5fd20c86762cbf46d4 Mon Sep 17 00:00:00 2001 From: iris-wy Date: Thu, 5 Dec 2024 22:55:25 +0800 Subject: [PATCH 08/23] Add Zemismart ZM02 multiple language support (#1785) Co-authored-by: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> --- tools/localizations/cn.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/localizations/cn.csv b/tools/localizations/cn.csv index 2f51db2f6e..fe9cf9d27e 100644 --- a/tools/localizations/cn.csv +++ b/tools/localizations/cn.csv @@ -79,4 +79,6 @@ Aqara Wireless Mini Switch T1,Aqara 无线开关 T1 "WallHero Switch (8 Way)",八位智能开关/场景面板 "WallHero Outlet",智能墙面五孔插座 "WallHero Remote Control (4-Inch)",语音场景(4寸)面板 +"Zemismart ZM02 Smart Curtain",Zemismart ZM02 智能窗帘 "Zemismart ZM25C Smart Curtain",Zemismart ZM25C 智能窗帘 + From 8cee6edebf24ccbe029127c3754faf75e0b5a1a0 Mon Sep 17 00:00:00 2001 From: iris-wy Date: Thu, 5 Dec 2024 22:55:47 +0800 Subject: [PATCH 09/23] Add Zemismart Zm02 Curtian Motor (#1784) * Add Zemismart Zm02 Curtian Motor * Update drivers/SmartThings/matter-window-covering/fingerprints.yml Co-authored-by: Khenon Walker <71702963+wkhenon@users.noreply.github.com> --------- Co-authored-by: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Co-authored-by: Khenon Walker <71702963+wkhenon@users.noreply.github.com> --- drivers/SmartThings/matter-window-covering/fingerprints.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/SmartThings/matter-window-covering/fingerprints.yml b/drivers/SmartThings/matter-window-covering/fingerprints.yml index 59aa93e896..016f92af31 100644 --- a/drivers/SmartThings/matter-window-covering/fingerprints.yml +++ b/drivers/SmartThings/matter-window-covering/fingerprints.yml @@ -26,6 +26,11 @@ matterManufacturer: vendorId: 0x139C productId: 0xFF15 deviceProfileName: window-covering + - id: "5020/64050" + deviceLabel: Zemismart ZM02 Smart Curtain + vendorId: 0x139C + productId: 0xFA32 + deviceProfileName: window-covering - id: "5020/64017" deviceLabel: Zemismart ZM25C Smart Curtain vendorId: 0x139C From ab626b60b7f92784886e6e56b5a12c5870e70c1c Mon Sep 17 00:00:00 2001 From: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:35:19 -0500 Subject: [PATCH 10/23] new-devices-Aqara-T2-bulbs (#1781) --- drivers/SmartThings/matter-switch/fingerprints.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index 1dd9b85c53..e3d17b5bb8 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -1,4 +1,15 @@ matterManufacturer: +#Aqara + - id: "4447/6145" + deviceLabel: Aqara LED Bulb T2 RGB CCT + vendorId: 0x115F + productId: 0x1801 + deviceProfileName: light-color-level + - id: "4447/6146" + deviceLabel: Aqara LED Bulb T2 CCT + vendorId: 0x115F + productId: 0x1802 + deviceProfileName: light-level-colorTemperature-2700K-6500K #Chengdu - id: "5218/8197" deviceLabel: Magic Cube DS001 From 90740772b37b00c25a36d01666048c8cb7c4ff5c Mon Sep 17 00:00:00 2001 From: Steven Green Date: Thu, 5 Dec 2024 15:08:57 -0800 Subject: [PATCH 11/23] CHAD-12279 Some zigbee locks reporting invalid lockStates Fixes a crash seen when some locks report an invalid value for the LockState --- drivers/SmartThings/zigbee-lock/src/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/SmartThings/zigbee-lock/src/init.lua b/drivers/SmartThings/zigbee-lock/src/init.lua index b6465b0729..2271230bdb 100644 --- a/drivers/SmartThings/zigbee-lock/src/init.lua +++ b/drivers/SmartThings/zigbee-lock/src/init.lua @@ -322,11 +322,11 @@ local lock_state_handler = function(driver, device, value, zb_rx) local delay = device:get_field(DELAY_LOCK_EVENT) or 100 if (delay < MAX_DELAY) then device.thread:call_with_delay(delay+.5, function () - device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, LOCK_STATE[value.value]) + device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, LOCK_STATE[value.value] or attr.unknown()) end) else device:set_field(DELAY_LOCK_EVENT, socket.gettime()) - device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, LOCK_STATE[value.value]) + device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, LOCK_STATE[value.value] or attr.unknown()) end end From 43bdeb77487beabdc2163fe987c619b676733bdd Mon Sep 17 00:00:00 2001 From: Steven Green Date: Thu, 5 Dec 2024 15:24:31 -0800 Subject: [PATCH 12/23] CHAD-12274 fixes occasional null pointer --- drivers/SmartThings/zigbee-switch/src/preferences.lua | 2 +- drivers/SmartThings/zwave-sensor/src/preferences.lua | 2 +- drivers/SmartThings/zwave-smoke-alarm/src/init.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/SmartThings/zigbee-switch/src/preferences.lua b/drivers/SmartThings/zigbee-switch/src/preferences.lua index 64c003eb56..66f7dabbba 100644 --- a/drivers/SmartThings/zigbee-switch/src/preferences.lua +++ b/drivers/SmartThings/zigbee-switch/src/preferences.lua @@ -54,7 +54,7 @@ preferences.update_preferences = function(driver, device, args) local prefs = preferences.get_device_parameters(device) if prefs ~= nil then for id, value in pairs(device.preferences) do - if not (args and args.old_st_store) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then + if not (args and args.old_st_store and args.old_st_store.preferences) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then local message = prefs[id](device, value) device:send(message) end diff --git a/drivers/SmartThings/zwave-sensor/src/preferences.lua b/drivers/SmartThings/zwave-sensor/src/preferences.lua index a83f49eeb8..48ee75d78e 100644 --- a/drivers/SmartThings/zwave-sensor/src/preferences.lua +++ b/drivers/SmartThings/zwave-sensor/src/preferences.lua @@ -156,7 +156,7 @@ preferences.update_preferences = function(driver, device, args) local prefs = preferences.get_device_parameters(device) if prefs ~= nil then for id, value in pairs(device.preferences) do - if not (args and args.old_st_store) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then + if not (args and args.old_st_store and args.old_st_store.preferences) or (args.old_st_store.preferences[id] ~= value and prefs and prefs[id]) then local new_parameter_value = preferences.to_numeric_value(device.preferences[id]) device:send(Configuration:Set({parameter_number = prefs[id].parameter_number, size = prefs[id].size, configuration_value = new_parameter_value})) end diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/init.lua index 17f6348474..0d0a5d1bfd 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/init.lua @@ -30,7 +30,7 @@ local preferencesMap = require "preferences" local function update_preferences(self, device, args) local preferences = preferencesMap.get_device_parameters(device) for id, value in pairs(device.preferences) do - if not (args and args.old_st_store) or (args.old_st_store.preferences[id] ~= value and preferences and preferences[id]) then + if not (args and args.old_st_store and args.old_st_store.preferences) or (args.old_st_store.preferences[id] ~= value and preferences and preferences[id]) then local new_parameter_value = preferencesMap.to_numeric_value(device.preferences[id]) device:send(Configuration:Set({parameter_number = preferences[id].parameter_number, size = preferences[id].size, configuration_value = new_parameter_value})) end From 802a03aaff98a239871a2cd5d4db5a1d3c739eed Mon Sep 17 00:00:00 2001 From: Kwang-Hui <54692798+Kwang-Hui@users.noreply.github.com> Date: Fri, 6 Dec 2024 08:50:21 +0900 Subject: [PATCH 13/23] STSE-3372: fix Aqara dimmer blinking (#1774) * STSE-3372: Fix Aqara Dimmer Controller T1 Pro blinking issue * STSE-3372 update test case * update test case for doConfigure fix missing On/OffTransitionTime test --- .../zigbee-switch/src/aqara-light/init.lua | 12 +++++++---- .../zigbee-switch/src/preferences.lua | 12 +++++++++++ .../src/test/test_aqara_led_bulb.lua | 21 +++++++++++-------- .../src/test/test_aqara_light.lua | 21 ++++++++++++------- 4 files changed, 46 insertions(+), 20 deletions(-) diff --git a/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua b/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua index 7225246299..3009cb6d0c 100644 --- a/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua @@ -2,6 +2,7 @@ local clusters = require "st.zigbee.zcl.clusters" local cluster_base = require "st.zigbee.cluster_base" local data_types = require "st.zigbee.data_types" local capabilities = require "st.capabilities" +local preferences = require "preferences" local OnOff = clusters.OnOff local Level = clusters.Level @@ -32,13 +33,15 @@ local function do_refresh(self, device) device:send(ColorControl.attributes.ColorTemperatureMireds:read(device)) end -local function do_configure(self, device) - device:configure() +local function device_added(driver, device, event) device:send(cluster_base.write_manufacturer_specific_attribute(device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1)) -- private +end + +local function do_configure(self, device) + device:configure() - device:send(Level.attributes.OnTransitionTime:write(device, 0)) - device:send(Level.attributes.OffTransitionTime:write(device, 0)) + preferences.sync_preferences(self, device) device:send(ColorControl.commands.MoveToColorTemperature(device, 200, 0x0000)) do_refresh(self, device) @@ -54,6 +57,7 @@ end local aqara_light_handler = { NAME = "Aqara Light Handler", lifecycle_handlers = { + added = device_added, doConfigure = do_configure }, capability_handlers = { diff --git a/drivers/SmartThings/zigbee-switch/src/preferences.lua b/drivers/SmartThings/zigbee-switch/src/preferences.lua index 64c003eb56..928163fef1 100644 --- a/drivers/SmartThings/zigbee-switch/src/preferences.lua +++ b/drivers/SmartThings/zigbee-switch/src/preferences.lua @@ -62,6 +62,18 @@ preferences.update_preferences = function(driver, device, args) end end +preferences.sync_preferences = function(driver, device) + local prefs = preferences.get_device_parameters(device) + if prefs ~= nil then + for id, value in pairs(device.preferences) do + if prefs and prefs[id] then + local message = prefs[id](device, value) + device:send(message) + end + end + end +end + preferences.get_device_parameters = function(zigbee_device) for _, device in pairs(devices) do if zigbee_device:get_manufacturer() == device.MATCHING_MATRIX.mfr and diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua index f3b86453dd..45bc9f3242 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua @@ -52,21 +52,24 @@ end test.set_test_init_function(test_init) +test.register_coroutine_test( + "Handle added lifecycle", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + + test.socket.zigbee:__expect_send({ + mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) + end +) + test.register_coroutine_test( "Configure should configure all necessary attributes and refresh device", function() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) test.socket.zigbee:__set_channel_ordering("relaxed") - test.socket.zigbee:__expect_send( - { - mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID - , MFG_CODE, data_types.Uint8, 1) - } - ) - test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnTransitionTime:write(mock_device, 0) }) - test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OffTransitionTime:write(mock_device, 0) }) test.socket.zigbee:__expect_send( { mock_device.id, diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua index a9517ab626..6bd83a7afa 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua @@ -33,6 +33,7 @@ local TURN_OFF_INDICATOR_ATTRIBUTE_ID = 0x0203 local mock_device = test.mock_device.build_test_zigbee_device( { profile = t_utils.get_profile_definition("aqara-light.yml"), + preferences = { ["stse.lightFadeInTimeInSec"] = 0, ["stse.lightFadeOutTimeInSec"] = 0 }, fingerprinted_endpoint_id = 0x01, zigbee_endpoints = { [1] = { @@ -53,21 +54,27 @@ end test.set_test_init_function(test_init) +test.register_coroutine_test( + "Handle added lifecycle", + function() + test.socket.zigbee:__set_channel_ordering("relaxed") + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + + test.socket.zigbee:__expect_send({ + mock_device.id, cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, + PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1) }) + end +) + test.register_coroutine_test( "Configure should configure all necessary attributes and refresh device", function() test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) test.socket.zigbee:__set_channel_ordering("relaxed") - test.socket.zigbee:__expect_send( - { - mock_device.id, - cluster_base.write_manufacturer_specific_attribute(mock_device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID - , MFG_CODE, data_types.Uint8, 1) - } - ) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnTransitionTime:write(mock_device, 0) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OffTransitionTime:write(mock_device, 0) }) + test.socket.zigbee:__expect_send( { mock_device.id, From a310a2d091f7a2fb0b7240bd04932769337d4295 Mon Sep 17 00:00:00 2001 From: cjswedes Date: Mon, 9 Dec 2024 09:28:14 -0600 Subject: [PATCH 14/23] Remove health_check functionality from zigbee-smoke-detector This is done to get some memory and latency performance increases. Tested with the Orvibo gas detector. --- .../zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua index 1e0b456002..a4d62fa1a4 100644 --- a/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua +++ b/drivers/SmartThings/zwave-smoke-alarm/src/fibaro-smoke-sensor/init.lua @@ -77,6 +77,7 @@ local fibaro_smoke_sensor = { }, NAME = "fibaro smoke sensor", can_handle = can_handle_fibaro_smoke_sensor, + health_check = false, } return fibaro_smoke_sensor From f8f29b9a3e35310f2224faa426e094bfab8cc1df Mon Sep 17 00:00:00 2001 From: nickolas-deboom <158304111+nickolas-deboom@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:58:10 -0600 Subject: [PATCH 15/23] Adding profile for plug/button device (#1806) --- .../matter-switch/profiles/plug-button.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 drivers/SmartThings/matter-switch/profiles/plug-button.yml diff --git a/drivers/SmartThings/matter-switch/profiles/plug-button.yml b/drivers/SmartThings/matter-switch/profiles/plug-button.yml new file mode 100644 index 0000000000..0f9e8b1b56 --- /dev/null +++ b/drivers/SmartThings/matter-switch/profiles/plug-button.yml @@ -0,0 +1,18 @@ +name: plug-button +components: + - id: main + capabilities: + - id: switch + version: 1 + - id: firmwareUpdate + version: 1 + - id: refresh + version: 1 + categories: + - name: SmartPlug + - id: button + capabilities: + - id: button + version: 1 + categories: + - name: RemoteController From c49efcc909812676fa38a28b7f622a9552b2028e Mon Sep 17 00:00:00 2001 From: Steven Green Date: Mon, 9 Dec 2024 11:19:33 -0800 Subject: [PATCH 16/23] Translation: make translation deploy tolerant of extra newlines --- tools/deploy.py | 13 +++++++------ tools/localizations/cn.csv | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/deploy.py b/tools/deploy.py index 6e980a23de..5cc47a9c0b 100644 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -49,12 +49,13 @@ with open(localization_file) as csvfile: reader = csv.reader(csvfile) for row in reader: - print("en: "+row[0]+" "+LOCALE+": "+row[1]) - subprocess.run( - "find . -name 'fingerprints.yml' | xargs sed -i -E 's/deviceLabel ?: \"?"+row[0].translate(slash_escape)+"\"?/deviceLabel: "+row[1].translate(slash_escape)+"/g'", - shell=True, - cwd=os.path.dirname(current_path) - ) + if len(row) > 1: + print("en: "+row[0]+" "+LOCALE+": "+row[1]) + subprocess.run( + "find . -name 'fingerprints.yml' | xargs sed -i -E 's/deviceLabel ?: \"?"+row[0].translate(slash_escape)+"\"?/deviceLabel: "+row[1].translate(slash_escape)+"/g'", + shell=True, + cwd=os.path.dirname(current_path) + ) subprocess.run("git status", shell=True) diff --git a/tools/localizations/cn.csv b/tools/localizations/cn.csv index fe9cf9d27e..59c6705447 100644 --- a/tools/localizations/cn.csv +++ b/tools/localizations/cn.csv @@ -80,5 +80,4 @@ Aqara Wireless Mini Switch T1,Aqara 无线开关 T1 "WallHero Outlet",智能墙面五孔插座 "WallHero Remote Control (4-Inch)",语音场景(4寸)面板 "Zemismart ZM02 Smart Curtain",Zemismart ZM02 智能窗帘 -"Zemismart ZM25C Smart Curtain",Zemismart ZM25C 智能窗帘 - +"Zemismart ZM25C Smart Curtain",Zemismart ZM25C 智能窗帘 \ No newline at end of file From c98c227eb95494338044e00f2d545e767f70b2bf Mon Sep 17 00:00:00 2001 From: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:20:28 -0500 Subject: [PATCH 17/23] Adding fingerprint for U Tect 0002 bulb --- drivers/SmartThings/matter-switch/fingerprints.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index a622bcc142..91432d9a52 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -578,6 +578,11 @@ matterManufacturer: vendorId: 0x147F productId: 0x0004 deviceProfileName: switch-binary + - id: "5247/2" + deviceLabel: UTEC Smart Matter Light Bulb + vendorId: 0x147F + productId: 0x0002 + deviceProfileName: light-color-level-2700K-6500K #WiZ - id: "WiZ A19" deviceLabel: WiZ A19 From 2046f10f68a8804f57d0d81291d7c92a6e795006 Mon Sep 17 00:00:00 2001 From: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:18:16 -0500 Subject: [PATCH 18/23] new-device-neo-motion --- drivers/SmartThings/matter-sensor/fingerprints.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/SmartThings/matter-sensor/fingerprints.yml b/drivers/SmartThings/matter-sensor/fingerprints.yml index 7e4a3ae4b6..3ce21fa053 100644 --- a/drivers/SmartThings/matter-sensor/fingerprints.yml +++ b/drivers/SmartThings/matter-sensor/fingerprints.yml @@ -69,6 +69,12 @@ matterManufacturer: vendorId: 0x1021 productId: 0x0001 deviceProfileName: motion-contact-battery + # Neo + - id: "4991/1123" + deviceLabel: Motion Sensor + vendorId: 0x137F + productId: 0x0463 + deviceProfileName: motion-battery #Tuo - id: "5150/3" deviceLabel: "TUO Temperature Sensor" From 9969dabc1c50aecddabfa06c9c6a369a7e404768 Mon Sep 17 00:00:00 2001 From: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:35:45 -0500 Subject: [PATCH 19/23] Adding door sensor --- drivers/SmartThings/matter-sensor/fingerprints.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/SmartThings/matter-sensor/fingerprints.yml b/drivers/SmartThings/matter-sensor/fingerprints.yml index 3ce21fa053..b9d323a5f6 100644 --- a/drivers/SmartThings/matter-sensor/fingerprints.yml +++ b/drivers/SmartThings/matter-sensor/fingerprints.yml @@ -70,6 +70,11 @@ matterManufacturer: productId: 0x0001 deviceProfileName: motion-contact-battery # Neo + - id: "4991/1122" + deviceLabel: Door Sensor + vendorId: 0x137F + productId: 0x0462 + deviceProfileName: contact-battery - id: "4991/1123" deviceLabel: Motion Sensor vendorId: 0x137F From 16b9201096018c34b94c22e62ba0502d0b2b4b83 Mon Sep 17 00:00:00 2001 From: Alissa Dornbos <79465613+lelandblue@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:51:56 -0500 Subject: [PATCH 20/23] Adding power plug fingerprint --- drivers/SmartThings/matter-switch/fingerprints.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/SmartThings/matter-switch/fingerprints.yml b/drivers/SmartThings/matter-switch/fingerprints.yml index 91432d9a52..702a196b84 100644 --- a/drivers/SmartThings/matter-switch/fingerprints.yml +++ b/drivers/SmartThings/matter-switch/fingerprints.yml @@ -442,6 +442,12 @@ matterManufacturer: vendorId: 0x115A productId: 0x004B deviceProfileName: light-color-level-2700K-6500K +#Neo + - id: "4991/635" + deviceLabel: Power Plug + vendorId: 0x137F + productId: 0x027B + deviceProfileName: plug-binary #SONOFF - id: "SONOFF MINIR4M" deviceLabel: Smart Plug-in Unit From c64029571fcc453639f4e83eb1dd490d0876a96c Mon Sep 17 00:00:00 2001 From: cjswedes Date: Mon, 28 Oct 2024 23:54:55 -0500 Subject: [PATCH 21/23] Update zigbee tests for native handler support Hub FW 0.55.x adds support for colorTemperature and colorControl commands to native handlers. And the lua libs are registering for default for those commands for Zigbee/matter devices. --- .../src/test/test_all_capability_zigbee_bulb.lua | 2 ++ .../zigbee-switch/src/test/test_aqara_led_bulb.lua | 1 + .../SmartThings/zigbee-switch/src/test/test_aqara_light.lua | 1 + drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua | 3 +++ .../SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua | 5 ++++- .../zigbee-switch/src/test/test_zll_rgbw_bulb.lua | 3 +++ 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua index 71f1efb426..81d355d889 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_all_capability_zigbee_bulb.lua @@ -348,6 +348,7 @@ test.register_coroutine_test( function() test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setColor") test.socket.zigbee:__expect_send( { mock_device.id, @@ -382,6 +383,7 @@ test.register_coroutine_test( function() test.socket.zigbee:__set_channel_ordering("relaxed") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorTemperature", component = "main", command = "setColorTemperature", args = {1800}}}) + mock_device:expect_native_cmd_handler_registration("colorTemperature", "setColorTemperature") test.socket.zigbee:__expect_send({mock_device.id, ColorControl.server.commands.MoveToColorTemperature(mock_device, 556, 0x0000)}) test.socket.zigbee:__expect_send({mock_device.id, OnOff.server.commands.On(mock_device)}) test.wait_for_events() diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua index 45bc9f3242..9c7a7cc0e5 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua @@ -123,6 +123,7 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "colorTemperature", component = "main", command = "setColorTemperature", args = { 200 } } }) + mock_device:expect_native_cmd_handler_registration("colorTemperature", "setColorTemperature") local temp_in_mired = math.floor(1000000 / 200) test.socket.zigbee:__expect_send( { diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua index 6bd83a7afa..68f54c986f 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua @@ -128,6 +128,7 @@ test.register_coroutine_test( test.socket.capability:__queue_receive({ mock_device.id, { capability = "colorTemperature", component = "main", command = "setColorTemperature", args = { 200 } } }) + mock_device:expect_native_cmd_handler_registration("colorTemperature", "setColorTemperature") local temp_in_mired = math.floor(1000000 / 200) test.socket.zigbee:__expect_send( { diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua index 2aa6dece8f..5f7e37f5eb 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_rgb_bulb.lua @@ -131,6 +131,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setHue", args = { 50 } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setHue") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) }) local hue = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -154,6 +155,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setSaturation", args = { 50 } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setSaturation") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) }) local saturation = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -176,6 +178,7 @@ test.register_coroutine_test( function() test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setColor") test.socket.zigbee:__expect_send( { mock_device.id, diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua index 32e8956250..61a9fcf1ac 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_rgbw_bulb.lua @@ -162,6 +162,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setHue", args = { 50 } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setHue") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) }) local hue = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -185,6 +186,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setSaturation", args = { 50 } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setSaturation") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) }) local saturation = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -208,6 +210,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setColor") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) local hue = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -228,7 +231,7 @@ test.register_coroutine_test( ) test.register_coroutine_test( - "Set Saturation command test", + "Set ColorTemperature command test", function() test.timer.__create_and_queue_test_time_advance_timer(1, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorTemperature", component = "main", command = "setColorTemperature", args = { 200 } } }) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua index f2d8c5f2f4..a7aaaf5e82 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_zll_rgbw_bulb.lua @@ -197,6 +197,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setHue", args = { 50 } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setHue") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) }) local hue = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -221,6 +222,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setSaturation", args = { 50 } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setSaturation") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.commands.On(mock_device) }) local saturation = math.floor((50 * 0xFE) / 100.0 + 0.5) @@ -245,6 +247,7 @@ test.register_coroutine_test( test.timer.__create_and_queue_test_time_advance_timer(2, "oneshot") test.socket.capability:__queue_receive({mock_device.id, { capability = "colorControl", component = "main", command = "setColor", args = { { hue = 50, saturation = 50 } } } }) + mock_device:expect_native_cmd_handler_registration("colorControl", "setColor") test.socket.zigbee:__expect_send({ mock_device.id, OnOff.server.commands.On(mock_device) }) local hue = math.floor((50 * 0xFE) / 100.0 + 0.5) From 6780dbdea5c7c68b751744e08ac7177885a354a7 Mon Sep 17 00:00:00 2001 From: cjswedes Date: Wed, 11 Dec 2024 09:47:09 -0600 Subject: [PATCH 22/23] Update tests that were only passing because of a bug in the test framework There was a bug in the integration test framework that wasn't properly validating native handler registration api calls at the end of a test. --- .../test_matter_multi_button_switch_mcd.lua | 8 ----- .../test/test_fibaro_walli_double_switch.lua | 4 --- .../src/test/test_zooz_double_plug.lua | 32 ------------------- 3 files changed, 44 deletions(-) diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua index a5f2420557..bf6eefee2b 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_multi_button_switch_mcd.lua @@ -256,14 +256,6 @@ test.register_message_test( { capability = "switch", component = "main", command = "on", args = { } } } }, - { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_device.id, capability_id = "switch", capability_cmd_id = "on" } - } - }, { channel = "matter", direction = "send", diff --git a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua index 40d45eb200..11746559a5 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_fibaro_walli_double_switch.lua @@ -437,7 +437,6 @@ test.register_coroutine_test( mock_parent.id, { capability = "switch", component = "main", command = "on", args = {} } }) - mock_parent:expect_native_cmd_handler_registration("switch", "on") test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( @@ -505,7 +504,6 @@ test.register_coroutine_test( mock_parent.id, { capability = "switch", component = "main", command = "off", args = {} } }) - mock_parent:expect_native_cmd_handler_registration("switch", "off") test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( @@ -572,7 +570,6 @@ test.register_coroutine_test( mock_child.id, { capability = "switch", component = "main", command = "on", args = {} } }) - mock_child:expect_native_cmd_handler_registration("switch", "on") test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( @@ -637,7 +634,6 @@ test.register_coroutine_test( mock_child.id, { capability = "switch", component = "main", command = "off", args = {} } }) - mock_child:expect_native_cmd_handler_registration("switch", "off") test.socket.zwave:__expect_send( zw_test_utils.zwave_test_build_send_command( diff --git a/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua b/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua index bc5c4e94a1..9f7f7d5b86 100644 --- a/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua +++ b/drivers/SmartThings/zwave-switch/src/test/test_zooz_double_plug.lua @@ -191,14 +191,6 @@ test.register_message_test( { capability = "switch", command = "on", component = "switch1", args = {} } } }, - { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_parent.id, capability_id = "switch", capability_cmd_id = "on" } - } - }, { channel = "zwave", direction = "send", @@ -223,14 +215,6 @@ test.register_message_test( { capability = "switch", command = "off", component = "main", args = {} } } }, - { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_parent.id, capability_id = "switch", capability_cmd_id = "off" } - } - }, { channel = "zwave", direction = "send", @@ -256,14 +240,6 @@ test.register_message_test( { capability = "switch", command = "on", component = "switch1", args = {} } } }, - { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_child.id, capability_id = "switch", capability_cmd_id = "on" } - } - }, { channel = "zwave", direction = "send", @@ -288,14 +264,6 @@ test.register_message_test( { capability = "switch", command = "off", component = "main", args = {} } } }, - { - channel = "devices", - direction = "send", - message = { - "register_native_capability_cmd_handler", - { device_uuid = mock_child.id, capability_id = "switch", capability_cmd_id = "off" } - } - }, { channel = "zwave", direction = "send", From fb10f6e1bb894ae18f2faa6e47105858b1f19cf2 Mon Sep 17 00:00:00 2001 From: cjswedes Date: Wed, 11 Dec 2024 10:07:40 -0600 Subject: [PATCH 23/23] Fix matter profile switch test Its not clear if this fix is the correct fix or not. --- .../matter-switch/src/test/test_matter_switch_device_types.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua b/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua index 4329cbce65..d896607284 100644 --- a/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua +++ b/drivers/SmartThings/matter-switch/src/test/test_matter_switch_device_types.lua @@ -345,7 +345,9 @@ end local function test_init_water_valve() test.mock_device.add_test_device(mock_device_water_valve) + test.socket.device_lifecycle:__queue_receive({ mock_device_water_valve.id, "doConfigure" }) mock_device_water_valve:expect_metadata_update({ profile = "water-valve-level" }) + mock_device_water_valve:expect_metadata_update({ provisioning_state = "PROVISIONED" }) end local function test_init_parent_child_different_types() @@ -394,6 +396,7 @@ local function test_init_parent_child_unsupported_device_type() }) end + test.register_coroutine_test( "Test profile change on init for onoff parent cluster as server", function()