From 655ed87d51fe5987e6e5944b1f8dbeedd4746425 Mon Sep 17 00:00:00 2001 From: Cooper Towns Date: Wed, 13 Aug 2025 22:10:55 -0500 Subject: [PATCH] Matter Switch: remove double init on device added The device_added handler was calling device_init in order to account for situations where device_init was not called due to a race condition with the device cache. Since lifecycle events are now guaranteed and ordered with FW 58, we no longer need to depend on this extra init. --- drivers/SmartThings/matter-switch/src/init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/SmartThings/matter-switch/src/init.lua b/drivers/SmartThings/matter-switch/src/init.lua index c8e3f47cec..768f4d3925 100644 --- a/drivers/SmartThings/matter-switch/src/init.lua +++ b/drivers/SmartThings/matter-switch/src/init.lua @@ -1325,8 +1325,12 @@ local function device_added(driver, device) device:send(req) end - -- call device init in case init is not called after added due to device caching - device_init(driver, device) + + -- The device init event is guaranteed in FW versions 58+, so this is only needed for older hubs + if version.rpc < 10 then + -- call device init in case init is not called after added due to device caching + device_init(driver, device) + end end local function temperature_attr_handler(driver, device, ib, response)