@@ -92,6 +92,35 @@ local mock_device_dimmer = test.mock_device.build_test_matter_device({
9292 }
9393})
9494
95+ local mock_device_switch_vendor_override = test .mock_device .build_test_matter_device ({
96+ profile = t_utils .get_profile_definition (" switch-binary.yml" ),
97+ manufacturer_info = {
98+ vendor_id = 0x109B ,
99+ product_id = 0x1001 ,
100+ },
101+ endpoints = {
102+ {
103+ endpoint_id = 0 ,
104+ clusters = {
105+ {cluster_id = clusters .Basic .ID , cluster_type = " SERVER" },
106+ },
107+ device_types = {
108+ {device_type_id = 0x0016 , device_type_revision = 1 } -- RootNode
109+ }
110+ },
111+ {
112+ endpoint_id = 1 ,
113+ clusters = {
114+ {cluster_id = clusters .OnOff .ID , cluster_type = " SERVER" , cluster_revision = 1 , feature_map = 0 },
115+ },
116+ device_types = {
117+ {device_type_id = 0x010A , device_type_revision = 1 } -- OnOff PlugIn Unit
118+ }
119+ }
120+ }
121+ })
122+
123+
95124local mock_device_color_dimmer = test .mock_device .build_test_matter_device ({
96125 profile = t_utils .get_profile_definition (" matter-thing.yml" ),
97126 manufacturer_info = {
@@ -485,6 +514,18 @@ local function test_init_color_dimmer()
485514 mock_device_color_dimmer :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
486515end
487516
517+ local function test_init_switch_vendor_override ()
518+ test .mock_device .add_test_device (mock_device_switch_vendor_override )
519+ local subscribe_request = clusters .OnOff .attributes .OnOff :subscribe (mock_device_switch_vendor_override )
520+ test .socket .device_lifecycle :__queue_receive ({ mock_device_switch_vendor_override .id , " added" })
521+ test .socket .matter :__expect_send ({mock_device_switch_vendor_override .id , subscribe_request })
522+ test .socket .device_lifecycle :__queue_receive ({ mock_device_switch_vendor_override .id , " init" })
523+ test .socket .matter :__expect_send ({mock_device_switch_vendor_override .id , subscribe_request })
524+ test .socket .device_lifecycle :__queue_receive ({ mock_device_switch_vendor_override .id , " doConfigure" })
525+ mock_device_switch_vendor_override :expect_metadata_update ({ profile = " switch-binary" })
526+ mock_device_switch_vendor_override :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
527+ end
528+
488529local function test_init_mounted_on_off_control ()
489530 test .mock_device .add_test_device (mock_device_mounted_on_off_control )
490531 local cluster_subscribe_list = {
@@ -677,6 +718,13 @@ test.register_coroutine_test(
677718 { test_init = test_init_onoff_client }
678719)
679720
721+ test .register_coroutine_test (
722+ " Test init for device with requiring the switch category as a vendor override" ,
723+ function ()
724+ end ,
725+ { test_init = test_init_switch_vendor_override }
726+ )
727+
680728test .register_coroutine_test (
681729 " Test init for mounted onoff control parent cluster as server" ,
682730 function ()
0 commit comments