老的ZWAVE客户端可能会通过alarm report command上报告警,这里通过一个实例解析这个命令。
Alarm Report Command
QQ:380939960
The Alarm ReportCommand is used by the application to report the alarm state.
有些厂家在打开关闭时会通过Alarm告知用户当前门锁的状态;
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Command Class = COMMAND_CLASS_ALARM | |||||||
Command = ALARM_REPORT | |||||||
Alarm Type | |||||||
Alarm Level | |||||||
Zensor Net Source Node ID | |||||||
Z-Wave Alarm Status | |||||||
Z-Wave Alarm Type | |||||||
Z-Wave Alarm Event | |||||||
Number of Event Parameters | |||||||
Event Parameter 1 | |||||||
... | |||||||
Event Parameter N |
Alarm Type (8bits)
Same as for AlarmCommand Class (Version 1).
Alarm Level (8bits)
Same as for AlarmCommand Class (Version 1).
Zensor Net SourceNode ID (8 bits)
Specify the ZensorNet Source Node ID, which detected the alarm condition. In Zensor Net it is notpossible to determine the Source Node ID due to the broadcast forwarded frameis without this information on protocol level. If the device is not based onZensor Net this field MUST be set to ‘0’.
Z-Wave AlarmStatus (8 bits)
See Alarm SetCommand.
Number of EventParameters (8 bits)
Indicates theNumber of Event Parameters fields used in bytes.
Z-Wave Alarm Type(8 bits), Z-Wave Alarm Event (8 bits) and Event Parameters (N Byte)
Table 11 specifiesthe Alarm Types and its subordinate parameters defined by the Z-Wave Alliance.The fields that do not contain any definition of the Z-Wave Alarm Type MUST beset to ‘0’ in the Alarm Report Command.
The device MUSTadvertise support of the Command Class which is included for the specific AlarmType. Example: for Smoke Alarm, Smoke Detected the Node Naming and LocationCommand Class MUST be advertised as supported in the Node Information Frame.
Table 11, AlarmReport :: Z-Wave Alarm Type & Event
Z-Wave Alarm Type (8 bits) | Z-Wave Alarm Event (8 bits) | Event Parameters (N Byte) | ||
Reserved | 0x00 | Reserved |
| 0x00 |
Smoke Alarm | 0x01 | Reserved |
| 0x00 |
Smoke detected | 0x01 | Node Location Report (Node Naming and Location Command Class, version 1) | ||
Smoke detected, Unknown Location | 0x02 |
| ||
Reserved | 0x03- 0xFD |
| ||
Unknown Event | 0xFE |
| ||
Reserved | 0xFF |
| ||
| ||||
Access Control Alarm | 0x06 | Reserved | 0x00 |
|
Manual Lock Operation | 0x01 |
| ||
Manual Unlock Operation | 0x02 |
| ||
RF Lock Operation | 0x03 |
| ||
RF Unlock Operation | 0x04 |
| ||
Keypad Lock Operation | 0x05 | User Identifier of User Code Report (User Code Command Class) | ||
Keypad Unlock Operation | 0x06 | User Identifier of User Code Report (User Code Command Class) | ||
Reserved | 0x07- 0xFD |
| ||
Unknown Event | 0xFE |
| ||
Reserved | 0xFF |
|
Alarm Type = 0xFF isused by the Alarm Get Command to retrieve the first alarm detection from thelist of pending alarms.
Example: a devicesupports the Z-Wave Alarm Types: Smoke, CO2 andHeat. The Heat Alarm is active e.g. overheat has been detected. When the devicereceives Alarm Get, Z-Wave Alarm Type (0xFF), it must return Alarm Report,Z-Wave Alarm Type (0x04), Z-Wave Alarm Event (0x01/0x02) and the accompanied parameters.
Z-WAVE SM-600A 实例
cmdClass = 0x71 cmd = 0x05 alarmType = 0x06 alarmLevel = 0x02 zensorNetSourceNodeId = 0x00 zwaveAlarmStatus = 0xff zwaveAlarmType = 0x06 // Access Control Alarm zwaveAlarmEvent = 0x02 // Manual Unlock Operation numberOfEventParameters = 0x00 eventParameter1 = 0x00 eventParameter2 = 0x00 eventParameter3 = 0x00 eventParameter4 = 0x00
另外该门锁在timeout自动上锁后,会上报如下的alarm,但是Z-Wave Alarm Event是0x09,在2016-07-21的protocol中Alarm Command Class没有定义该类型的event。不过该类型在Notification Command Class我们可以找到0x09对应AutoLock Locked Operation (V3) alarmType = 0x06 alarmLevel = 0x09 zensorNetSourceNodeId= 0x00 zwaveAlarmStatus =0xff zwaveAlarmType = 0x06 // AccessControl(V2) zwaveAlarmEvent = 0x09 // Auto Lock Locked Operation (V3) numberOfEventParameters= 0x00 eventParameter1 =0x00 eventParameter2 =0x00 eventParameter3 =0x00 eventParameter4 = 0x00
|
但是在Notification Command Class,对于notification又有新的定义; 并且新版本的协议中使用NOTIFICATION_REPORT 来替代ALARM_REPORT上报事件上报。The Notification Command Class supersedesthe Alarm Command Class. 因此上面
Notification Type (8 bits) | Z-Wave Alarm Event (8 bits) | Event Parameters (N Byte) | ||
Reserved | 0x00 | Reserved |
| 0x00 |
| ||||
Access Control Alarm | 0x06 | Event inactive (push mode) / Previous Events cleared (pull mode) (V4) | 0x00 | - Event identifier for the event which is no more active. - If no Event Parameter is provided, there are no active events for the specified Notification Type. |
Manual Lock Operation | 0x01 |
| ||
Manual Unlock Operation | 0x02 |
| ||
RF Lock Operation | 0x03 |
| ||
RF Unlock Operation | 0x04 |
| ||
Keypad Lock Operation | 0x05 | User Identifier of User Code Report (User Code Command Class) | ||
Keypad Unlock Operation | 0x06 | User Identifier of User Code Report (User Code Command Class) | ||
Manual Not Fully Locked Operation (V3) | 0x07 |
| ||
RF Not Fully Locked Operation (V3) | 0x08 |
| ||
Auto Lock Locked Operation (V3) | 0x09 |
| ||
Auto Lock Not Fully Operation (V3) | 0x0A |
| ||
Lock Jammed (V3) | 0x0B |
| ||
All user codes deleted (V3) | 0x0C |
| ||
Single user code deleted (V3) | 0x0D |
| ||
New user code added (V3) | 0x0E |
| ||
New user code not added due to duplicate code (V3) | 0x0F |
| ||
Keypad temporary disabled (V3) | 0x10 |
| ||
Keypad busy (V3) | 0x11 |
| ||
New Program code Entered - Unique code for lock configuration (V3) | 0x12 |
| ||
Manually Enter user Access code exceeds code limit (V3) | 0x13 |
| ||
Unlock By RF with invalid user code (V3) | 0x14 |
| ||
Locked by RF with invalid user codes (V3) | 0x15 |
| ||
Window/Door is open (V3) | 0x16 |
| ||
Window/Door is closed (V3) | 0x17 |
| ||
Reserved | 0x18-0x3F |
| ||
Barrier performing Initialization process (V4) | 0x40 | (1 byte) 0xFF = Performing Process 0x00 = Process Complete 0x01 – 0xFE = Reserved | ||
Barrier operation (Open / Close) force has been exceeded. (V4) | 0x41 |
| ||
Barrier motor has exceeded manufacturer’s operational time limit (V4) | 0x42 | (1 byte) 0x00-0x7F = 0sec-127sec 0x80-0xFE = 1min-127min | ||
Barrier operation has exceeded physical mechanical limits. (For example: barrier has opened past the open limit) (V4) | 0x43 |
| ||
| ……. |
|