@@ -362,6 +362,49 @@ local mock_device_parent_child_unsupported_device_type = test.mock_device.build_
362
362
}
363
363
})
364
364
365
+ local mock_device_light_level_motion = test .mock_device .build_test_matter_device ({
366
+ profile = t_utils .get_profile_definition (" light-level-motion.yml" ),
367
+ manufacturer_info = {
368
+ vendor_id = 0x0000 ,
369
+ product_id = 0x0000 ,
370
+ },
371
+ endpoints = {
372
+ {
373
+ endpoint_id = 0 ,
374
+ clusters = {
375
+ {cluster_id = clusters .Basic .ID , cluster_type = " SERVER" },
376
+ },
377
+ device_types = {
378
+ {device_type_id = 0x0016 , device_type_revision = 1 } -- RootNode
379
+ }
380
+ },
381
+ {
382
+ endpoint_id = 1 ,
383
+ clusters = {
384
+ {
385
+ cluster_id = clusters .OnOff .ID ,
386
+ cluster_type = " SERVER" ,
387
+ cluster_revision = 1 ,
388
+ feature_map = 0 , -- u32 bitmap
389
+ },
390
+ {cluster_id = clusters .LevelControl .ID , cluster_type = " SERVER" }
391
+ },
392
+ device_types = {
393
+ {device_type_id = 0x0101 , device_type_revision = 1 } -- Dimmable Light
394
+ }
395
+ },
396
+ {
397
+ endpoint_id = 2 ,
398
+ clusters = {
399
+ {cluster_id = clusters .OccupancySensing .ID , cluster_type = " SERVER" },
400
+ },
401
+ device_types = {
402
+ {device_type_id = 0x0107 , device_type_revision = 1 } -- Occupancy Sensor
403
+ }
404
+ }
405
+ }
406
+ })
407
+
365
408
local function test_init_parent_child_switch_types ()
366
409
local subscribe_request = clusters .OnOff .attributes .OnOff :subscribe (mock_device_parent_child_switch_types )
367
410
test .socket .matter :__expect_send ({mock_device_parent_child_switch_types .id , subscribe_request })
@@ -505,6 +548,23 @@ local function test_init_parent_child_unsupported_device_type()
505
548
})
506
549
end
507
550
551
+ local function test_init_light_level_motion ()
552
+ local cluster_subscribe_list = {
553
+ clusters .OnOff .attributes .OnOff ,
554
+ clusters .LevelControl .attributes .CurrentLevel ,
555
+ clusters .LevelControl .attributes .MaxLevel ,
556
+ clusters .LevelControl .attributes .MinLevel ,
557
+ clusters .OccupancySensing .attributes .Occupancy
558
+ }
559
+ local subscribe_request = cluster_subscribe_list [1 ]:subscribe (mock_device_light_level_motion )
560
+ for i , cluster in ipairs (cluster_subscribe_list ) do
561
+ if i > 1 then
562
+ subscribe_request :merge (cluster :subscribe (mock_device_light_level_motion ))
563
+ end
564
+ end
565
+ test .socket .matter :__expect_send ({mock_device_light_level_motion .id , subscribe_request })
566
+ test .mock_device .add_test_device (mock_device_light_level_motion )
567
+ end
508
568
509
569
test .register_coroutine_test (
510
570
" Test profile change on init for onoff parent cluster as server" ,
@@ -528,21 +588,21 @@ test.register_coroutine_test(
528
588
)
529
589
530
590
test .register_coroutine_test (
531
- " Test profile change on init for onoff parent cluster as client" ,
591
+ " Test init for onoff parent cluster as client" ,
532
592
function ()
533
593
end ,
534
594
{ test_init = test_init_onoff_client }
535
595
)
536
596
537
597
test .register_coroutine_test (
538
- " Test profile change on init for mounted onoff control parent cluster as server" ,
598
+ " Test init for mounted onoff control parent cluster as server" ,
539
599
function ()
540
600
end ,
541
601
{ test_init = test_init_mounted_on_off_control }
542
602
)
543
603
544
604
test .register_coroutine_test (
545
- " Test profile change on init for mounted dimmable load control parent cluster as server" ,
605
+ " Test init for mounted dimmable load control parent cluster as server" ,
546
606
function ()
547
607
end ,
548
608
{ test_init = test_init_mounted_dimmable_load_control }
@@ -583,4 +643,11 @@ test.register_coroutine_test(
583
643
{ test_init = test_init_parent_child_unsupported_device_type }
584
644
)
585
645
646
+ test .register_coroutine_test (
647
+ " Test init for light with motion sensor" ,
648
+ function ()
649
+ end ,
650
+ { test_init = test_init_light_level_motion }
651
+ )
652
+
586
653
test .run_registered_tests ()
0 commit comments