2424 SupervisionStatus ,
2525 Weekday ,
2626)
27+ from zwave_js_server .const .command_class .battery import BatteryReplacementStatus
2728from zwave_js_server .const .command_class .entry_control import (
2829 EntryControlDataType ,
2930 EntryControlEventType ,
3031)
3132from zwave_js_server .const .command_class .multilevel_switch import (
3233 MultilevelSwitchCommand ,
3334)
35+ from zwave_js_server .const .command_class .notification import (
36+ AccessControlNotificationEvent ,
37+ NotificationType ,
38+ )
3439from zwave_js_server .const .command_class .power_level import PowerLevelTestStatus
3540from zwave_js_server .event import Event
3641from zwave_js_server .exceptions import (
@@ -1039,8 +1044,11 @@ async def test_notification(lock_schlage_be469: node_pkg.Node):
10391044 assert event .data ["notification" ].command_class == CommandClass .NOTIFICATION
10401045 assert event .data ["notification" ].node_id == 23
10411046 assert event .data ["notification" ].endpoint_idx == 0
1042- assert event .data ["notification" ].type_ == 6
1043- assert event .data ["notification" ].event == 5
1047+ assert event .data ["notification" ].type_ == NotificationType .ACCESS_CONTROL
1048+ assert (
1049+ event .data ["notification" ].event
1050+ == AccessControlNotificationEvent .KEYPAD_LOCK_OPERATION
1051+ )
10441052 assert event .data ["notification" ].label == "Access Control"
10451053 assert event .data ["notification" ].event_label == "Keypad lock operation"
10461054 assert event .data ["notification" ].parameters == {"userId" : 1 }
@@ -1053,7 +1061,7 @@ async def test_notification(lock_schlage_be469: node_pkg.Node):
10531061 "event" : "notification" ,
10541062 "nodeId" : 23 ,
10551063 "endpointIndex" : 0 ,
1056- "ccId" : CommandClass . POWERLEVEL . value ,
1064+ "ccId" : 115 ,
10571065 "args" : {"testNodeId" : 1 , "status" : 0 , "acknowledgedFrames" : 2 },
10581066 },
10591067 )
@@ -1074,7 +1082,7 @@ async def test_notification(lock_schlage_be469: node_pkg.Node):
10741082 "event" : "notification" ,
10751083 "nodeId" : 23 ,
10761084 "endpointIndex" : 0 ,
1077- "ccId" : CommandClass . SWITCH_MULTILEVEL . value ,
1085+ "ccId" : 38 ,
10781086 "args" : {"direction" : "up" , "eventType" : 4 , "eventTypeLabel" : "c" },
10791087 },
10801088 )
@@ -1098,7 +1106,7 @@ async def test_notification(lock_schlage_be469: node_pkg.Node):
10981106 "event" : "notification" ,
10991107 "nodeId" : 23 ,
11001108 "endpointIndex" : 0 ,
1101- "ccId" : CommandClass . SWITCH_MULTILEVEL . value ,
1109+ "ccId" : 38 ,
11021110 "args" : {"eventType" : 4 , "eventTypeLabel" : "c" },
11031111 },
11041112 )
@@ -1114,6 +1122,29 @@ async def test_notification(lock_schlage_be469: node_pkg.Node):
11141122 )
11151123 assert event .data ["notification" ].event_type_label == "c"
11161124
1125+ # Validate that Battery CC notification event is received as expected
1126+ event = Event (
1127+ type = "notification" ,
1128+ data = {
1129+ "source" : "node" ,
1130+ "event" : "notification" ,
1131+ "nodeId" : 23 ,
1132+ "ccId" : 128 ,
1133+ "endpointIndex" : 0 ,
1134+ "args" : {
1135+ "eventType" : "battery low" ,
1136+ "urgency" : 1 ,
1137+ },
1138+ },
1139+ )
1140+
1141+ node .handle_notification (event )
1142+ assert event .data ["notification" ].command_class == CommandClass .BATTERY
1143+ assert event .data ["notification" ].node_id == 23
1144+ assert event .data ["notification" ].endpoint_idx == 0
1145+ assert event .data ["notification" ].event_type == "battery low"
1146+ assert event .data ["notification" ].urgency == BatteryReplacementStatus .SOON
1147+
11171148
11181149async def test_notification_unknown (lock_schlage_be469 : node_pkg .Node , caplog ):
11191150 """Test unrecognized command class notification events."""
0 commit comments