From b3f7a4d0c262fea048eb0886ca35a48c9b2b308d Mon Sep 17 00:00:00 2001 From: Harrison Carter Date: Wed, 5 Aug 2026 12:00:54 -0500 Subject: [PATCH 1/5] Add logging on create/update of EDGE_CHILD devices --- .../matter-switch/src/switch_utils/device_configuration.lua | 3 +++ 1 file changed, 3 insertions(+) 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 130fd1c1e4..9534cd660c 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua @@ -1,6 +1,7 @@ -- Copyright © 2025 SmartThings, Inc. -- Licensed under the Apache License, Version 2.0 +local st_utils = require "st.utils" local capabilities = require "st.capabilities" local clusters = require "st.matter.clusters" local version = require "version" @@ -39,6 +40,7 @@ function ChildConfiguration.create_or_update_child_devices(driver, device, serve local child_profile, optional_component_capabilities = assign_profile_fn(device, ep_id, true) local existing_child_device = device:get_field(fields.IS_PARENT_CHILD_DEVICE) and switch_utils.find_child(device, ep_id) if not existing_child_device then + device.log.info_with({hub_logs=true}, string.format("Creating child device for endpoint %d with profile %s", ep_id, child_profile)) driver:try_create_device({ type = "EDGE_CHILD", label = label_and_name, @@ -48,6 +50,7 @@ function ChildConfiguration.create_or_update_child_devices(driver, device, serve vendor_provided_label = label_and_name }) else + device.log.info_with({hub_logs=true}, string.format("Updating child device for endpoint %d with profile %s and enabled capabilities %s", ep_id, child_profile, st_utils.stringify_table(optional_component_capabilities))) existing_child_device:try_update_metadata({ profile = child_profile, optional_component_capabilities = optional_component_capabilities From edaa67d7072da115ace5ae15d3866e11a06671c4 Mon Sep 17 00:00:00 2001 From: Harrison Carter Date: Wed, 5 Aug 2026 12:25:16 -0500 Subject: [PATCH 2/5] add some more debug logging --- .../matter-switch/src/switch_handlers/attribute_handlers.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua b/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua index 753c76992e..f03bc9db35 100644 --- a/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua +++ b/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua @@ -333,6 +333,8 @@ function AttributeHandlers.available_endpoints_handler(driver, device, ib, respo device.log.warn("Received an AvailableEndpoints response but no Electrical Sensor endpoints have been identified as supporting the Power Topology cluster with SET feature. Ignoring this response.") return end + + device.log.debug_with({hub_logs=true}, string.format("Handling AvailableEndpoints response for endpoint %d with elements: %s", ib.endpoint_id, st_utils.stringify_table(ib.data.elements))) for i, set_ep_info in pairs(set_topology_eps or {}) do if ib.endpoint_id == set_ep_info.endpoint_id then -- since EP response is being handled here, remove it from the ELECTRICAL_SENSOR_EPS table @@ -366,6 +368,8 @@ function AttributeHandlers.parts_list_handler(driver, device, ib, response) device.log.warn("Received a PartsList response but no Electrical Sensor endpoints have been identified as supporting the Power Topology cluster with TREE feature. Ignoring this response.") return end + + device.log.debug_with({hub_logs=true}, string.format("Handling PartsList response for endpoint %d with elements: %s", ib.endpoint_id, st_utils.stringify_table(ib.data.elements))) for i, tree_ep_info in pairs(tree_topology_eps or {}) do if ib.endpoint_id == tree_ep_info.endpoint_id then -- since EP response is being handled here, remove it from the ELECTRICAL_SENSOR_EPS table From 569932246dc04984bf4e9630d4484964a94649ea Mon Sep 17 00:00:00 2001 From: Harrison Carter Date: Wed, 5 Aug 2026 13:14:25 -0500 Subject: [PATCH 3/5] remove update logging, this is handled by api directly --- .../matter-switch/src/switch_utils/device_configuration.lua | 1 - 1 file changed, 1 deletion(-) 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 9534cd660c..2ccf7be05d 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua @@ -50,7 +50,6 @@ function ChildConfiguration.create_or_update_child_devices(driver, device, serve vendor_provided_label = label_and_name }) else - device.log.info_with({hub_logs=true}, string.format("Updating child device for endpoint %d with profile %s and enabled capabilities %s", ep_id, child_profile, st_utils.stringify_table(optional_component_capabilities))) existing_child_device:try_update_metadata({ profile = child_profile, optional_component_capabilities = optional_component_capabilities From 19b1549446fc0bb08865151452aecb9272fcea40 Mon Sep 17 00:00:00 2001 From: Harrison Carter Date: Wed, 5 Aug 2026 15:36:06 -0500 Subject: [PATCH 4/5] remove st_utils require --- .../matter-switch/src/switch_utils/device_configuration.lua | 1 - 1 file changed, 1 deletion(-) 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 2ccf7be05d..8e5f797877 100644 --- a/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua +++ b/drivers/SmartThings/matter-switch/src/switch_utils/device_configuration.lua @@ -1,7 +1,6 @@ -- Copyright © 2025 SmartThings, Inc. -- Licensed under the Apache License, Version 2.0 -local st_utils = require "st.utils" local capabilities = require "st.capabilities" local clusters = require "st.matter.clusters" local version = require "version" From cf9ca492da5bf97109c329c5847257bf9cc2ac97 Mon Sep 17 00:00:00 2001 From: Harrison Carter Date: Wed, 5 Aug 2026 15:37:44 -0500 Subject: [PATCH 5/5] fix possible nil error --- .../matter-switch/src/switch_handlers/attribute_handlers.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua b/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua index f03bc9db35..ae1f219606 100644 --- a/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua +++ b/drivers/SmartThings/matter-switch/src/switch_handlers/attribute_handlers.lua @@ -334,7 +334,7 @@ function AttributeHandlers.available_endpoints_handler(driver, device, ib, respo return end - device.log.debug_with({hub_logs=true}, string.format("Handling AvailableEndpoints response for endpoint %d with elements: %s", ib.endpoint_id, st_utils.stringify_table(ib.data.elements))) + device.log.debug_with({hub_logs=true}, string.format("Handling AvailableEndpoints response for endpoint %d with elements: %s", ib.endpoint_id, st_utils.stringify_table(ib.data.elements or {}))) for i, set_ep_info in pairs(set_topology_eps or {}) do if ib.endpoint_id == set_ep_info.endpoint_id then -- since EP response is being handled here, remove it from the ELECTRICAL_SENSOR_EPS table @@ -369,7 +369,7 @@ function AttributeHandlers.parts_list_handler(driver, device, ib, response) return end - device.log.debug_with({hub_logs=true}, string.format("Handling PartsList response for endpoint %d with elements: %s", ib.endpoint_id, st_utils.stringify_table(ib.data.elements))) + device.log.debug_with({hub_logs=true}, string.format("Handling PartsList response for endpoint %d with elements: %s", ib.endpoint_id, st_utils.stringify_table(ib.data.elements or {}))) for i, tree_ep_info in pairs(tree_topology_eps or {}) do if ib.endpoint_id == tree_ep_info.endpoint_id then -- since EP response is being handled here, remove it from the ELECTRICAL_SENSOR_EPS table