@@ -449,14 +449,17 @@ end
449449--- @param subscribed_attributes table key-value pairs mapping capability ids to subscribed attributes
450450--- @param subscribed_events table key-value pairs mapping capability ids to subscribed events
451451function utils .populate_subscribe_request_for_device (checked_device , subscribe_request , capabilities_seen , attributes_seen , events_seen , subscribed_attributes , subscribed_events )
452- for _ , component in pairs (checked_device .st_store .profile .components ) do
452+ local subscribed_attrs = {}
453+ for _ , component in pairs (checked_device .st_store .profile .components ) do
453454 for _ , capability in pairs (component .capabilities ) do
454455 if not capabilities_seen [capability .id ] then
455456 for _ , attr in ipairs (subscribed_attributes [capability .id ] or {}) do
456457 local cluster_id = attr .cluster or attr ._cluster .ID
457458 local attr_id = attr .ID or attr .attribute
458459 if not attributes_seen [cluster_id .. attr_id ] then
459460 local ib = im .InteractionInfoBlock (nil , cluster_id , attr_id )
461+ subscribed_attrs [cluster_id ] = subscribed_attrs [cluster_id ] or {}
462+ subscribed_attrs [cluster_id ][attr_id ] = ib
460463 subscribe_request :with_info_block (ib )
461464 attributes_seen [cluster_id .. attr_id ] = true
462465 end
@@ -474,6 +477,7 @@ function utils.populate_subscribe_request_for_device(checked_device, subscribe_r
474477 end
475478 end
476479 end
480+ checked_device :set_field (fields .SUBSCRIBED_ATTRIBUTES_KEY , subscribed_attrs )
477481end
478482
479483--- create and send a subscription request by checking all devices, accounting for both parent and child devices
0 commit comments