@@ -187,21 +187,27 @@ function ButtonDeviceConfiguration.configure_buttons(device, momentary_switch_ep
187187 end
188188end
189189
190- function WindowCoveringDeviceConfiguration .assign_profile_for_window_covering_ep (device )
191- local profile_name = " window-covering"
192- if # device :get_endpoints (clusters .WindowCovering .ID , {feature_bitmap = clusters .WindowCovering .types .Feature .TILT }) > 0 then
193- profile_name = profile_name .. " -tilt"
194- if # device :get_endpoints (clusters .WindowCovering .ID , {feature_bitmap = clusters .WindowCovering .types .Feature .LIFT }) == 0 then
195- profile_name = profile_name .. " -only"
196- end
190+ function WindowCoveringDeviceConfiguration .assign_profile_for_window_covering_ep (device , server_window_covering_ep_id )
191+ local ep_info = switch_utils .get_endpoint_info (device , server_window_covering_ep_id )
192+ local window_covering_cluster_info = switch_utils .find_cluster_on_ep (ep_info , clusters .WindowCovering .ID )
193+ local optional_supported_component_capabilities = {}
194+ local main_component_capabilities = {}
195+
196+ if clusters .WindowCovering .are_features_supported (clusters .WindowCovering .types .Feature .LIFT , window_covering_cluster_info .feature_map ) then
197+ table.insert (main_component_capabilities , capabilities .windowShadeLevel .ID )
198+ end
199+ if clusters .WindowCovering .are_features_supported (clusters .WindowCovering .types .Feature .TILT , window_covering_cluster_info .feature_map ) then
200+ table.insert (main_component_capabilities , capabilities .windowShadeTiltLevel .ID )
197201 end
198202 local battery_support = device :get_field (fields .profiling_data .BATTERY_SUPPORT ) or fields .battery_support .NO_BATTERY
199203 if battery_support == fields .battery_support .BATTERY_PERCENTAGE then
200- profile_name = profile_name .. " - battery"
204+ table.insert ( main_component_capabilities , capabilities . battery . ID )
201205 elseif battery_support == fields .battery_support .BATTERY_LEVEL then
202- profile_name = profile_name .. " - batteryLevel"
206+ table.insert ( main_component_capabilities , capabilities . batteryLevel . ID )
203207 end
204- return profile_name
208+
209+ table.insert (optional_supported_component_capabilities , {" main" , main_component_capabilities })
210+ return " window-covering-modular" , optional_supported_component_capabilities
205211end
206212
207213
@@ -272,7 +278,7 @@ function DeviceConfiguration.match_profile(driver, device)
272278 ChildConfiguration .create_or_update_child_devices (driver , device , window_covering_ep_ids , default_endpoint_id , WindowCoveringDeviceConfiguration .assign_profile_for_window_covering_ep )
273279 end
274280 if switch_utils .tbl_contains (window_covering_ep_ids , default_endpoint_id ) then
275- updated_profile = WindowCoveringDeviceConfiguration .assign_profile_for_window_covering_ep (device )
281+ updated_profile , optional_component_capabilities = WindowCoveringDeviceConfiguration .assign_profile_for_window_covering_ep (device , default_endpoint_id )
276282 end
277283
278284 device :try_update_metadata ({ profile = updated_profile , optional_component_capabilities = optional_component_capabilities })
0 commit comments