From dbaed1fc3810a02e90e99718fdbbee4ea40bea57 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Fri, 25 Jul 2025 17:07:26 -0700 Subject: [PATCH 1/7] Zigbee child devices do not have endpoints --- drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index 59424dd784..636df730c1 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -17,7 +17,8 @@ local constants = require "st.zigbee.constants" local clusters = require "st.zigbee.zcl.clusters" local function zll_profile(opts, driver, device, zb_rx, ...) - local endpoint = device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)] + local endpoint = device.zigbee_endpoints and + (device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)]) if (endpoint.profile_id == constants.ZLL_PROFILE_ID) then local subdriver = require("zll-polling") return true, subdriver From 65cdc1b235e59765954ae9e3e147c55564f188ef Mon Sep 17 00:00:00 2001 From: Steven Green Date: Fri, 25 Jul 2025 17:19:07 -0700 Subject: [PATCH 2/7] fixup --- drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index 636df730c1..5a880a281e 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -19,7 +19,7 @@ local clusters = require "st.zigbee.zcl.clusters" local function zll_profile(opts, driver, device, zb_rx, ...) local endpoint = device.zigbee_endpoints and (device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)]) - if (endpoint.profile_id == constants.ZLL_PROFILE_ID) then + if (endpoint and endpoint.profile_id == constants.ZLL_PROFILE_ID) then local subdriver = require("zll-polling") return true, subdriver else From d0109da24d99202868e7a488207fea7b43e1f8b0 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Fri, 25 Jul 2025 17:25:34 -0700 Subject: [PATCH 3/7] fixup --- drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index 5a880a281e..ce540ba442 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -17,9 +17,9 @@ local constants = require "st.zigbee.constants" local clusters = require "st.zigbee.zcl.clusters" local function zll_profile(opts, driver, device, zb_rx, ...) - local endpoint = device.zigbee_endpoints and + local endpoint = device.zigbee_endpoints ~= nil and (device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)]) - if (endpoint and endpoint.profile_id == constants.ZLL_PROFILE_ID) then + if (endpoint ~= nil and endpoint.profile_id == constants.ZLL_PROFILE_ID) then local subdriver = require("zll-polling") return true, subdriver else From 439ca4c107851a435a0ae85f090143b3e94c57e1 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Fri, 25 Jul 2025 17:31:34 -0700 Subject: [PATCH 4/7] fixup --- drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index ce540ba442..dfec9d141e 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -19,7 +19,7 @@ local clusters = require "st.zigbee.zcl.clusters" local function zll_profile(opts, driver, device, zb_rx, ...) local endpoint = device.zigbee_endpoints ~= nil and (device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)]) - if (endpoint ~= nil and endpoint.profile_id == constants.ZLL_PROFILE_ID) then + if (endpoint and endpoint.profile_id == constants.ZLL_PROFILE_ID) then local subdriver = require("zll-polling") return true, subdriver else From 47452886744b7a4a4e02449ca49457fd0b40e1f6 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Fri, 25 Jul 2025 17:38:27 -0700 Subject: [PATCH 5/7] fixup --- drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index dfec9d141e..3f797d258b 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -17,7 +17,7 @@ local constants = require "st.zigbee.constants" local clusters = require "st.zigbee.zcl.clusters" local function zll_profile(opts, driver, device, zb_rx, ...) - local endpoint = device.zigbee_endpoints ~= nil and + local endpoint = device.zigbee_endpoints ~= nil and device.fingerprinted_endpoint_id ~= nil and (device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)]) if (endpoint and endpoint.profile_id == constants.ZLL_PROFILE_ID) then local subdriver = require("zll-polling") From 9921d549ede42485ad2e58066372777b28230240 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Fri, 25 Jul 2025 17:51:11 -0700 Subject: [PATCH 6/7] fixup --- .../zigbee-switch/src/zll-polling/init.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index 3f797d258b..bad0fd699c 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -17,14 +17,19 @@ local constants = require "st.zigbee.constants" local clusters = require "st.zigbee.zcl.clusters" local function zll_profile(opts, driver, device, zb_rx, ...) - local endpoint = device.zigbee_endpoints ~= nil and device.fingerprinted_endpoint_id ~= nil and - (device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)]) - if (endpoint and endpoint.profile_id == constants.ZLL_PROFILE_ID) then - local subdriver = require("zll-polling") - return true, subdriver - else - return false + local endpoints = device.zigbee_endpoints + local fingerprinted_endpoint_id = device.fingerprinted_endpoint_id + if endpoints ~= nil and fingerprinted_endpoint_id ~= nil then + local endpoint = endpoints[fingerprinted_endpoint_id] + if endpoint == nil then + endpoint = endpoints[tostring(fingerprinted_endpoint_id)] + end + if endpoint ~= nil and endpoint.profile_id ~= nil and endpoint.profile_id == constants.ZLL_PROFILE_ID then + local subdriver = require("zll-polling") + return true, subdriver + end end + return false end local function set_up_zll_polling(driver, device) From 8f84e0d2f65a9deebd3af1d5c4252df5c66439f3 Mon Sep 17 00:00:00 2001 From: Steven Green Date: Fri, 25 Jul 2025 17:58:00 -0700 Subject: [PATCH 7/7] fixup --- .../zigbee-switch/src/zll-polling/init.lua | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua index bad0fd699c..34c4fba25f 100644 --- a/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/zll-polling/init.lua @@ -16,17 +16,19 @@ local device_lib = require "st.device" local constants = require "st.zigbee.constants" local clusters = require "st.zigbee.zcl.clusters" -local function zll_profile(opts, driver, device, zb_rx, ...) - local endpoints = device.zigbee_endpoints - local fingerprinted_endpoint_id = device.fingerprinted_endpoint_id - if endpoints ~= nil and fingerprinted_endpoint_id ~= nil then - local endpoint = endpoints[fingerprinted_endpoint_id] - if endpoint == nil then - endpoint = endpoints[tostring(fingerprinted_endpoint_id)] - end - if endpoint ~= nil and endpoint.profile_id ~= nil and endpoint.profile_id == constants.ZLL_PROFILE_ID then - local subdriver = require("zll-polling") - return true, subdriver +local function zll_profile(opts, driver, device, ...) + if device ~= nil and device.network_type == device_lib.NETWORK_TYPE_ZIGBEE then + local endpoints = device.zigbee_endpoints + local fingerprinted_endpoint_id = device.fingerprinted_endpoint_id + if endpoints ~= nil and fingerprinted_endpoint_id ~= nil then + local endpoint = endpoints[fingerprinted_endpoint_id] + if endpoint == nil then + endpoint = endpoints[tostring(fingerprinted_endpoint_id)] + end + if endpoint ~= nil and endpoint.profile_id ~= nil and endpoint.profile_id == constants.ZLL_PROFILE_ID then + local subdriver = require("zll-polling") + return true, subdriver + end end end return false