Skip to content

Commit 5575a08

Browse files
committed
feat(test): Add soc_door_lock_keypad test
Origin: #148 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent 508cc7f commit 5575a08

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

scripts/tests/z-wave-stack-binaries-test.sh

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ play_net_add_node_()
426426
expect="$sub $expect"
427427

428428
NetworkStatus='Online functional'
429-
Security="Z-Wave S2 Authenticated"
429+
Security="Z-Wave S2 .*" # Authenticated or AccessControl (Doorlock)
430430
json='{"MaximumCommandDelay":'${MaximumCommandDelay}',"NetworkList":[""],"NetworkStatus":"'${NetworkStatus}'","Security":"'${Security}'"}'
431431
over_expect=$(echo "$json" | sed 's/\[/\\[/g; s/\]/\\]/g')
432432
over_expect="$sub $over_expect"
@@ -479,7 +479,7 @@ play_node_soc_switch_on_off_()
479479
log_ "$node: Play on $nodeid " # ~T738437 ~T738442"
480480
local attribute="$type"
481481

482-
log_ "$node: Initial state reported after inclusion"
482+
log_ "$node: Initial state reported after inclusion ($attribute)"
483483
message="{}"
484484
sub="ucl/by-unid/$nodeunid/ep0/$type/Attributes/$attribute/Reported"
485485
json='{"value":false}'
@@ -571,6 +571,44 @@ play_node_soc_multilevel_sensor_()
571571
}
572572

573573

574+
play_node_soc_door_lock_keypad_()
575+
{
576+
local node="soc_door_lock_keypad"
577+
local type="DoorLock"
578+
local attribute="LockState"
579+
580+
node_cli_ "$node" n
581+
log_ "$node: Play on $nodeid" # ~T738437 ~T738442
582+
583+
log_ "$node: Initial state reported after inclusion ($attribute)"
584+
585+
local ep="ep0/$type/SupportedCommands"
586+
local sub="ucl/by-unid/${nodeunid}/$ep"
587+
local key="value" ; key='"'$key'"' # JSON string
588+
local value='["LockDoor", "UnlockDoor", "Toggle", "SetPINCode", "GetPINCode", "ClearPINCode", "ClearAllPINCodes", "SetUserStatus", "GetUserStatus", "ForceReadAttributes"]';
589+
local json='{'$key': '$value'}'
590+
json=$(echo "$json" | sed 's/\[/\\[/g; s/\]/\\]/g')
591+
local expect="$sub $json"
592+
sub_ "$sub" "$expect"
593+
594+
sub="ucl/by-unid/$nodeunid/ep0/$type/Attributes/$attribute/Reported"
595+
value='Unlocked'
596+
json='{"value":"'$value'"}'
597+
expect="$sub $json"
598+
sub_ "$sub" "$expect"
599+
600+
local command="Toggle"
601+
local code="0000" # Any code is mandatory to prevent json parsing error (TODO)
602+
local message='{"PINOrRFIDCode":"'$code'"}'
603+
local pub="ucl/by-unid/$nodeunid/ep0/$type/Commands/$command"
604+
sub="ucl/by-unid/$nodeunid/ep0/$type/Attributes/$attribute/Reported"
605+
value='Locked'
606+
json='{"value":"'$value'"}'
607+
expect="$sub $json"
608+
pubsub_ "$pub" "$message" "$sub" "$expect"
609+
}
610+
611+
574612
play_node_s2v2_()
575613
{
576614
local task="s2v2"
@@ -634,6 +672,7 @@ play_nodes_()
634672
local nodes=(
635673
soc_switch_on_off
636674
soc_multilevel_sensor
675+
soc_door_lock_keypad
637676
)
638677
for node in ${nodes[@]} ; do
639678
node_cli_ $node h
@@ -735,6 +774,10 @@ split -v
735774
focus right
736775
screen -t "soc_multilevel_sensor" "3" $0 run_app_ soc_multilevel_sensor
737776
777+
split -v
778+
focus right
779+
screen -t "soc_door_lock_keypad" "4" $0 run_app_ soc_door_lock_keypad
780+
738781
focus down
739782
screen -t "zpc" "0" $0 run_ zpc
740783

0 commit comments

Comments
 (0)