Skip to content

Commit f402bc9

Browse files
bug fix for child devices
1 parent b53457f commit f402bc9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

drivers/SmartThings/matter-switch/src/common-utils.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ end
268268

269269
function common_utils.supports_modular_profile(device)
270270
return version.api >= 14 and version.rpc >= 8 and
271-
not (device.manufacturer_info.vendor_id == common_utils.AQARA_MANUFACTURER_ID and
271+
not (device.manufacturer_info and
272+
device.manufacturer_info.vendor_id == common_utils.AQARA_MANUFACTURER_ID and
272273
device.manufacturer_info.product_id == common_utils.AQARA_CLIMATE_SENSOR_W100_ID)
273274
end
274275

drivers/SmartThings/matter-switch/src/static-profiles/init.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ end
6060
local function handle_light_switch_with_onOff_server_clusters(device, main_endpoint)
6161
local cluster_id = 0
6262
for _, ep in ipairs(device.endpoints) do
63-
-- main_endpoint only supports server cluster by definition of get_endpoints()
63+
-- The main endpoint only supports server cluster by definition of get_endpoints()
6464
if main_endpoint == ep.endpoint_id then
6565
for _, dt in ipairs(ep.device_types) do
66-
-- no device type that is not in the switch subset should be considered.
66+
-- No device type that is not in the switch subset should be considered.
6767
if (common_utils.ON_OFF_SWITCH_ID <= dt.device_type_id and dt.device_type_id <= common_utils.ON_OFF_COLOR_DIMMER_SWITCH_ID) then
6868
cluster_id = math.max(cluster_id, dt.device_type_id)
6969
end
@@ -102,7 +102,7 @@ end
102102

103103
local function match_profile(driver, device)
104104
local main_endpoint = find_default_endpoint(device)
105-
-- initialize the main device card with buttons if applicable, and create child devices as needed for multi-switch devices.
105+
-- Initialize the main device card with buttons if applicable, and create child devices as needed for multi-switch devices.
106106
local profile_found = initialize_buttons_and_switches(driver, device, main_endpoint)
107107
if device:get_field(common_utils.IS_PARENT_CHILD_DEVICE) then
108108
device:set_find_child(common_utils.find_child)
@@ -149,7 +149,7 @@ local function device_init(driver, device)
149149
device:set_find_child(common_utils.find_child)
150150
end
151151
local main_endpoint = find_default_endpoint(device)
152-
-- ensure subscription to all endpoint attributes- including those mapped to child devices
152+
-- Ensure subscription to all endpoint attributes- including those mapped to child devices
153153
common_utils.add_subscribed_attributes_and_events(device, main_endpoint)
154154
device:subscribe()
155155
end

0 commit comments

Comments
 (0)