NEWS
Script für eigene Alarmanlage auf Zigbee Basis (IAS ACE)
-
The Zigbee ZCL standard https://zigbeealliance.org/wp-content/uploads/2019/12/07-5123-06-zigbee-cluster-library-specification.pdf defines a so called "Intruder Alarm System" (IAS).
The specification describer interaction between security devices and the intruder alarm system.
Some examples include:- Linkind ZS130000078 Security keypad battery
- Linkind ZS130000178 Security system key fob
- Immax Neo 07046L 4 Buttons
- Centralite security keypads
Those Zigbee ZCL IAS security devices can been registered successfully at iobroker.zigbee adapter but they need several responses from a security system to work properly.
Since these responses are not generated within the iobroker.zigbee adapter nor the zigbee.herdsman driver the devices keep sending repeated messages and report transmission failures (red leds etc) after some timeout.
More complex devices like panels will probably not work at all.Nevertheless with the following changes the iobroker.zigbee adapter is enabled to forward those responses to the devices when triggered from a js script.
@developer.js
in async sendToZigbee(obj) add else if (cmdType === 'functionalResp') { cmd = zcl.Utils.getCluster(cid).getCommandResponse(obj.message.cmd); } ... await this.zbController.publish(publishTarget, cid, cmd.name, zclData, cfg, ep, cmdType, (err, msg) => {}, obj.message.zclSeqNum);
@zigbeecontroller.js
add async publish() async publish(deviceID, cid, cmd, zclData, cfg, ep, type, callback, zclSeqNum) {} add else if () { if (!zclSeqNum) { this.error( `Zigbee cannot publish commandResponse message to device because zclSeqNum is not known` ); return; } cfg.disableDefaultResponse = false; const result = await endpoint.commandResponse(cid, cmd, zclData, cfg, zclSeqNum); if (callback) callback(undefined, result); }
I have generated pull request to integrate those changes: https://github.com/ioBroker/ioBroker.zigbee/pull/1283
It has already been acceted but it may still need some time till it is being published.Now a "fake security system" needs to be created. The following js can be used as a very simple and incomplete template:
var armMode = 0; //disarmed // register all devices added to iasace_keyfob or iasace_panel enum.function // note: msg_from_zigbee must be tagged on({enumId: /^enum\.functions\.iasace_(keyfob|panel)$/, change: "ne"}, function(obj) { var msg_rcvd; var senderId = obj.id.replace(".msg_from_zigbee", ""); console.log('ZID:' + senderId); msg_rcvd = (function () { try {return JSON.parse(getState(obj.id).val);} catch(e) {return {};}})(); console.log((' ID:' + obj.id + ' Msg:' + msg_rcvd.type + " SeqNum:" + msg_rcvd.meta.zclTransactionSequenceNumber + " ZoneID:" + msg_rcvd.data.zoneID)); switch(msg_rcvd.type) { case "commandGetPanelStatus": console.log(('Respond to commandGetPanelStatus\n')); sendTo("zigbee.0", "sendToZigbee", { "id": senderId, "ep": "1", "cid": "ssIasAce", "cmd": "getPanelStatusRsp", "cmdType": "functionalResp", "zclSeqNum": msg_rcvd.meta.zclTransactionSequenceNumber, "zclData": {"panelstatus": armMode,"secondsremain": "10","audiblenotif":"1","alarmstatus":"0"} }); break; case "commandArm": // for now don't check PIN and just respond success console.log(('Respond to commandArm for Zone: ' + msg_rcvd.data.armmode + ' PIN:' + msg_rcvd.data.code)); armMode = msg_rcvd.data.armmode; sendTo("zigbee.0", "sendToZigbee", { "id": senderId, "ep": "1", "cid": "ssIasAce", "cmd": "armRsp", "cmdType": "functionalResp", "zclSeqNum": msg_rcvd.meta.zclTransactionSequenceNumber, "zclData": {"armnotification": msg_rcvd.data.armmode} }); break; } });
It registers to changes on the "msg_from_zigbee" state which all zigbee devices have.
To only register for so called IAS ACE panel and keyfob devices I have created "enum.function.iasace_keyfob" and "enum.function.iasace_panel" enums and assigned them directly to the "msg_from_zigbee" states of the respective devices.
The reason to handle keyfobs and panels differently ist that the panel might be publicly accessible and sends a PIN code, keyfobs don't send a PIN. Nevertheless this is not handled by above easy template.The main messages send by devices are:
"commandArm" {"armmode":3,"code":"","zoneid":23} f.e. {"type":"commandArm","data":{"armmode":3,"code":"","zoneid":23},"linkquality":151,"groupID":null,"cluster":"ssIasAce","meta":{"zclTransactionSequenceNumber":8,"manufacturerCode":null,"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":0,"disableDefaultResponse":false,"reservedBits":0}},"endpoint_id":1}
which requires a "cmd": "armRsp"{"armnotification": msg_rcvd.data.armmode} response
and
"commandGetPanelStatus" f.e. {"type":"commandGetPanelStatus","data":{},"linkquality":255,"groupID":null,"cluster":"ssIasAce","meta":{"zclTransactionSequenceNumber":4,"manufacturerCode":null,"frameControl":{"frameType":1,"manufacturerSpecific":false,"direction":0,"disableDefaultResponse":false,"reservedBits":0}},"endpoint_id":1}
which requires a
"cmd": "getPanelStatusRsp" {"panelstatus": armMode,"secondsremain": "10","audiblenotif":"1","alarmstatus":"0"} responseFields are:
armmode:
--> following for command and response
0x00 Disarmed (all zones disarmed) and ready to arm
0x01 Armed stay
0x02 Armed night
0x03 Armed away
--> following only for response
0x04 Exit delay
0x05 Entry delay
0x06 Not ready to arm
0x07 In alarm
0x08 Arming Stay
0x09 Arming Night
0x0a Arming Awaysecondsremain
f.e. "10"audiblenotif:
0x00 Mute (i.e., no audible notification)
0x01 Default sound
0x80-0xff Manufacturer specific--> Alarm Status
0x00 No alarm
0x01 Burglar
0x02 Fire
0x03 Emergency
0x04 Police Panic
0x05 Fire Panic
0x06 Emergency Panic (i.e., medical issue)To send responses the
sendTo("zigbee.0", "sendToZigbee", { "id": senderId, "ep": "1", "cid": "ssIasAce", "cmd": "[getPanelStatusRsp|armRsp]", "cmdType": "functionalResp", "zclSeqNum": msg_rcvd.meta.zclTransactionSequenceNumber, "zclData": {...} });
can be used.
Sender ID must be same as from cmd.
"cmd" must be one of [getPanelStatusRsp|armRsp]
"cmdType" must be new "functionalResp"
new "zclSeqNum" parameter must be same as from cmd.I think around this template a "fake" intruder alarm script can be generated according to your needs in an iobroker JS without a big hazzle.
Thank you to @asgothian and @kirovilya for the great iobroker.zigbee adapter and their support!
Oliver -
Just a short comment. New version 1.6.8 of zigbee adapter now includes above changes and no need to patch the driver anymore. Thus you can directly go for creating your "intruder alarm system" JS or blockly scripts.
Best regards,
Oliver