@@ -623,4 +623,77 @@ test.register_coroutine_test(
623623 }
624624)
625625
626+
627+ local mock_nuki_smart_lock_ultra = test .mock_device .build_test_matter_device ({
628+ profile = t_utils .get_profile_definition (" lock-nocodes-notamper.yml" ),
629+ manufacturer_info = {
630+ vendor_id = 0x135D ,
631+ product_id = 0x00A1 ,
632+ },
633+ endpoints = {
634+ {
635+ endpoint_id = 0 ,
636+ clusters = {
637+ { cluster_id = clusters .BasicInformation .ID , cluster_type = " SERVER" },
638+ },
639+ device_types = {
640+ { device_type_id = 0x0016 , device_type_revision = 1 } -- RootNode
641+ }
642+ },
643+ {
644+ endpoint_id = 1 ,
645+ clusters = {
646+ {
647+ cluster_id = DoorLock .ID ,
648+ cluster_type = " SERVER" ,
649+ cluster_revision = 1 ,
650+ feature_map = 0x1000 , -- UNBOLT
651+ },
652+ {
653+ cluster_id = clusters .PowerSource .ID ,
654+ cluster_type = " SERVER" ,
655+ feature_map = 10
656+ },
657+ },
658+ device_types = {
659+ { device_type_id = 0x000A , device_type_revision = 1 } -- Door Lock
660+ }
661+ }
662+ }
663+ })
664+
665+ local battery_support = {
666+ NO_BATTERY = " NO_BATTERY" ,
667+ BATTERY_LEVEL = " BATTERY_LEVEL" ,
668+ BATTERY_PERCENTAGE = " BATTERY_PERCENTAGE"
669+ }
670+
671+ local profiling_data = {
672+ BATTERY_SUPPORT = " __BATTERY_SUPPORT" ,
673+ }
674+
675+ test .register_coroutine_test (
676+ " Test Nuki Smart Lock Ultra profile change with user and pin supported" ,
677+ function ()
678+ -- technically, since power source attributes must be read, this wouldn't be running via doConfigure, but this is straightforward.
679+ test .socket .device_lifecycle :__queue_receive ({ mock_nuki_smart_lock_ultra .id , " doConfigure" })
680+ test .socket .capability :__expect_send (
681+ mock_nuki_smart_lock_ultra :generate_test_message (" main" , capabilities .lock .supportedLockValues ({" locked" , " unlocked" , " unlatched" , " not fully locked" }, {visibility = {displayed = false }}))
682+ )
683+ test .socket .capability :__expect_send (
684+ mock_nuki_smart_lock_ultra :generate_test_message (" main" , capabilities .lock .supportedLockCommands ({" lock" , " unlock" , " unlatch" }, {visibility = {displayed = false }}))
685+ )
686+ mock_nuki_smart_lock_ultra :expect_metadata_update ({ profile = " lock-modular-embedded-unlatch" , optional_component_capabilities = {{" main" , {" battery" }}}})
687+ mock_nuki_smart_lock_ultra :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
688+ end ,
689+ {
690+ test_init = function ()
691+ test .disable_startup_messages ()
692+ test .mock_device .add_test_device (mock_nuki_smart_lock_ultra )
693+ mock_nuki_smart_lock_ultra :set_field (profiling_data .BATTERY_SUPPORT , battery_support .BATTERY_PERCENTAGE , {persist = true }) -- assume this has been set previously
694+ end ,
695+ min_api_version = 17
696+ }
697+ )
698+
626699test .run_registered_tests ()
0 commit comments