From f44090f78ed5bcc47af03aff1578d31b31a96bd0 Mon Sep 17 00:00:00 2001 From: Cooper Towns Date: Mon, 2 Dec 2024 18:09:58 -0600 Subject: [PATCH 01/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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/16] 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