Security System
Updated July 19, 2022 by OwlBawl, luwol03 and ShaquuUUID: 0000007E-0000-1000-8000-0026BB765291
Characteristics
Name | Required |
---|---|
Name | ✕ |
SecuritySystemAlarmType | ✕ |
StatusFault | ✕ |
StatusTampered | ✕ |
SecuritySystemCurrentState | ✓ |
SecuritySystemTargetState | ✓ |
Changing Characteristics properties example: security system with no “night” mode
{
"SecuritySystemCurrentState": {
"validValues": [0, 1, 3, 4]
},
"SecuritySystemTargetState": {
"validValues": [0, 1, 3, 4]
}
}
Example
This example uses node-red-contrib-alarm
as an “alarm panel”.
Many thanks for the devs over there!
The most basic parts are triggers going into alarm nodes and state changes coming to/from HomeKit. I have added in some handling of arming and disarming based on who is home and time of day (automatic arming at night or when we leave home). I am using MQTT for most of my triggers.
Finally, I have an “Alarm Noise” HomeKit node, this is a StatelessProgrammableSwitch
which is set in the Home.app to trigger various audio on my speakers (jaws for “you’re home but didn’t disarm” and alarm noise 15 seconds later).
Screenshot:
Flow:
[{"id":"766c39be.8c7968","type":"group","z":"87e774f7.91d8f8","name":"Visitor mode","style":{"label":true},"nodes":["a9becec5.a23c2","8f051ede.7a49c8","5b4ce46a.aaa6a4","3472b6ff.d353aa"],"x":154,"y":1099,"w":512,"h":122},{"id":"a9becec5.a23c2","type":"inject","z":"87e774f7.91d8f8","g":"766c39be.8c7968","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"On\":true}","payloadType":"json","x":280,"y":1140,"wires":[["3472b6ff.d353aa"]]},{"id":"8f051ede.7a49c8","type":"inject","z":"87e774f7.91d8f8","g":"766c39be.8c7968","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"On\":false}","payloadType":"json","x":270,"y":1180,"wires":[["3472b6ff.d353aa"]]},{"id":"5b4ce46a.aaa6a4","type":"change","z":"87e774f7.91d8f8","g":"766c39be.8c7968","name":"Visitor","rules":[{"t":"set","p":"Visitor","pt":"flow","to":"payload.On","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":1160,"wires":[[]]},{"id":"3472b6ff.d353aa","type":"homekit-service","z":"87e774f7.91d8f8","g":"766c39be.8c7968","isParent":true,"bridge":"f6e3ae59.c33c3","parentService":"","name":"Visitor","serviceName":"Switch","topic":"","filter":false,"manufacturer":"Garrett","model":"Dummy","serialNo":"93","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","outputs":2,"x":450,"y":1160,"wires":[["5b4ce46a.aaa6a4"],[]]},{"id":"f6e3ae59.c33c3","type":"homekit-bridge","bridgeName":"Security","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":true},{"id":"7fa37e86.98a658","type":"group","z":"87e774f7.91d8f8","name":"Automatic arm / disarm","style":{"label":true},"nodes":["e2fd85e9.38bb4","e1e11909.18e3d8","af493800.577c68","5e357d66.58632c","a207ada4.c4eda","9fd39ca3.de3a8","3eb203bf.00243c","40aee851.a357b","60bb626a.3a8c6c","e19ab0b4.bc136","887169e3.6d73b8","80c874d2.3c2b38","dd7fc967.234df"],"x":154,"y":499,"w":1102,"h":262},{"id":"e2fd85e9.38bb4","type":"function","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Presence","func":"// global.set('presence',msg.payload)\n\nconst heidiHome ={\n payload: msg.payload.heidiHome\n}\n\nconst garrettHome = {\n payload: msg.payload.garrettHome\n}\n\nconst anyoneHome = {\n payload: msg.payload.anyoneHome\n}\n\nflow.set('AnyoneHome',anyoneHome.payload);\n\nreturn [heidiHome,garrettHome,anyoneHome];\n","outputs":3,"noerr":0,"initialize":"","finalize":"","x":420,"y":600,"wires":[[],[],["e19ab0b4.bc136"]],"outputLabels":["Heidi","Garrett","Anyone"]},{"id":"e1e11909.18e3d8","type":"mqtt in","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Presence","topic":"global/presence/share","qos":"1","datatype":"json","broker":"5d1bb4a1.a59df4","x":240,"y":600,"wires":[["e2fd85e9.38bb4"]]},{"id":"af493800.577c68","type":"switch","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Home?","property":"AnyoneHome","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":580,"y":720,"wires":[["3eb203bf.00243c"]]},{"id":"5e357d66.58632c","type":"trigger","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Home delay","op1":"{\"SecuritySystemTargetState\":0}","op2":"{\"SecuritySystemCurrentState\":0}","op1type":"json","op2type":"json","duration":"15","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":810,"y":540,"wires":[["60bb626a.3a8c6c"],["40aee851.a357b"]]},{"id":"a207ada4.c4eda","type":"trigger","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Away delay","op1":"{\"SecuritySystemTargetState\":1}","op2":"{\"SecuritySystemCurrentState\":1}","op1type":"json","op2type":"json","duration":"15","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":810,"y":600,"wires":[["60bb626a.3a8c6c"],["40aee851.a357b"]]},{"id":"9fd39ca3.de3a8","type":"trigger","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Night delay","op1":"{\"SecuritySystemTargetState\":2}","op2":"{\"SecuritySystemCurrentState\":2}","op1type":"json","op2type":"json","duration":"15","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":810,"y":660,"wires":[["60bb626a.3a8c6c"],["40aee851.a357b"]]},{"id":"3eb203bf.00243c","type":"trigger","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Off delay","op1":"{\"SecuritySystemTargetState\":3}","op2":"{\"SecuritySystemCurrentState\":3}","op1type":"json","op2type":"json","duration":"500","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":800,"y":720,"wires":[["60bb626a.3a8c6c"],["40aee851.a357b"]]},{"id":"40aee851.a357b","type":"AnamicoAlarmChangeState","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"All states","panel":"2ac90055.7f83e8","format":"0","x":1130,"y":600,"wires":[]},{"id":"60bb626a.3a8c6c","type":"link out","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"TargetState link","links":["24d30bf1.c566d4"],"x":1150,"y":540,"wires":[],"l":true},{"id":"e19ab0b4.bc136","type":"trigger","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"","op1":"","op2":"","op1type":"nul","op2type":"date","duration":"15","extend":false,"overrideDelay":false,"units":"min","reset":"true","bytopic":"all","topic":"topic","outputs":1,"x":610,"y":600,"wires":[["a207ada4.c4eda"]]},{"id":"887169e3.6d73b8","type":"cronplus","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"10:30 PM","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"10:30 PM","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 30 22 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":420,"y":660,"wires":[["80c874d2.3c2b38"]]},{"id":"80c874d2.3c2b38","type":"switch","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"Home?","property":"AnyoneHome","propertyType":"flow","rules":[{"t":"false"},{"t":"true"}],"checkall":"true","repair":false,"outputs":2,"x":580,"y":660,"wires":[["a207ada4.c4eda"],["9fd39ca3.de3a8"]]},{"id":"dd7fc967.234df","type":"cronplus","z":"87e774f7.91d8f8","g":"7fa37e86.98a658","name":"6:30 AM","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"6:30 AM","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 30 6 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":420,"y":720,"wires":[["af493800.577c68"]]},{"id":"5d1bb4a1.a59df4","type":"mqtt-broker","name":"zQTT","broker":"10.1.1.2","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"2ac90055.7f83e8","type":"AnamicoAlarmPanel","name":"Alarm"},{"id":"88f46747.dee8b","type":"group","z":"87e774f7.91d8f8","name":"Homekit connections","style":{"label":true},"nodes":["1d31f18d.920b6e","7ec28de5.4b540c","f9a36ff2.37115","d56db4a6.5f02b8","2662f689.127952","f06b17c7.9e6f9","24d30bf1.c566d4","ef7c34f1.af964","44cd1a00.3dbad8","c3da314c.7fc418","428253de.5792ec","e03bcceb.983488","73192f73.f9586"],"x":154,"y":779,"w":1032,"h":302},{"id":"1d31f18d.920b6e","type":"homekit-service","z":"87e774f7.91d8f8","g":"88f46747.dee8b","isParent":true,"bridge":"f6e3ae59.c33c3","parentService":"","name":"Security","serviceName":"SecuritySystem","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","firmwareRev":"","hardwareRev":"","softwareRev":"","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","waitForSetupMsg":false,"outputs":2,"x":680,"y":860,"wires":[["f9a36ff2.37115"],[]]},{"id":"7ec28de5.4b540c","type":"homekit-service","z":"87e774f7.91d8f8","g":"88f46747.dee8b","isParent":true,"bridge":"f6e3ae59.c33c3","parentService":"","name":"Alarm Noise","serviceName":"StatelessProgrammableSwitch","topic":"","filter":false,"manufacturer":"Garrett","model":"Noise","serialNo":"94","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","outputs":2,"x":1090,"y":980,"wires":[[],[]]},{"id":"f9a36ff2.37115","type":"AnamicoAlarmChangeState","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"State from HK","panel":"2ac90055.7f83e8","format":"1","x":900,"y":860,"wires":[]},{"id":"d56db4a6.5f02b8","type":"AnamicoAlarmStateChanged","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"","panel":"2ac90055.7f83e8","format":"1","sendInitialState":1,"x":260,"y":860,"wires":[["1d31f18d.920b6e","e03bcceb.983488"]]},{"id":"2662f689.127952","type":"AnamicoAlarmTriggered","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"No delay","panel":"2ac90055.7f83e8","delay":"","x":440,"y":920,"wires":[["1d31f18d.920b6e","c3da314c.7fc418"]]},{"id":"f06b17c7.9e6f9","type":"AnamicoAlarmTriggered","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"15s delay","panel":"2ac90055.7f83e8","delay":"15","x":440,"y":980,"wires":[["428253de.5792ec"]]},{"id":"24d30bf1.c566d4","type":"link in","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"TargetState link","links":["60bb626a.3a8c6c"],"x":440,"y":820,"wires":[["1d31f18d.920b6e"]],"l":true},{"id":"ef7c34f1.af964","type":"switch","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"Turns off","property":"payload.SecuritySystemCurrentState","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":520,"y":1040,"wires":[["44cd1a00.3dbad8"]]},{"id":"44cd1a00.3dbad8","type":"change","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"Single press","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.ProgrammableSwitchEvent","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":1040,"wires":[["73192f73.f9586"]]},{"id":"c3da314c.7fc418","type":"change","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"Double press","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.ProgrammableSwitchEvent","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":920,"wires":[["73192f73.f9586"]]},{"id":"428253de.5792ec","type":"change","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"Long press","rules":[{"t":"delete","p":"payload","pt":"msg"},{"t":"set","p":"payload.ProgrammableSwitchEvent","pt":"msg","to":"2","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":980,"wires":[["73192f73.f9586"]]},{"id":"e03bcceb.983488","type":"rbe","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":370,"y":1040,"wires":[["ef7c34f1.af964"]]},{"id":"73192f73.f9586","type":"switch","z":"87e774f7.91d8f8","g":"88f46747.dee8b","name":"Visitor?","property":"Visitor","propertyType":"flow","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":900,"y":980,"wires":[[],["7ec28de5.4b540c"]]},{"id":"c331e1c0.8e1d68","type":"group","z":"87e774f7.91d8f8","name":"Triggers","style":{"label":true},"nodes":["c0bfc4d0.f5a2a8","9c881e5a.7fb18","ef849efa.988588","d55efbc1.28507","75ac6fcd.2d15a","24889f71.04343","c1aa7528.eed688","75bafd68.9f5a44","407dfc4a.f688a4","36f928bd.7e43a8","5e6cb16f.1f8498","77fc3491.bde72c","32c7b07d.721ae","68819d8.8e14f64","92de6221.cbc158"],"x":154,"y":39,"w":772,"h":442},{"id":"c0bfc4d0.f5a2a8","type":"mqtt in","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"OHD 1","topic":"zwave/Door/Heidi/48/1/0","qos":"1","datatype":"json","broker":"5d1bb4a1.a59df4","x":230,"y":260,"wires":[["ef849efa.988588"]]},{"id":"9c881e5a.7fb18","type":"switch","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"True","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"255","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":80,"wires":[["77fc3491.bde72c","32c7b07d.721ae"]]},{"id":"ef849efa.988588","type":"switch","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"True","property":"payload.value","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":430,"y":320,"wires":[["77fc3491.bde72c","32c7b07d.721ae","68819d8.8e14f64"]]},{"id":"d55efbc1.28507","type":"link in","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Security Cam Motion","links":["4c710694.2062f"],"x":280,"y":140,"wires":[["75ac6fcd.2d15a"]],"l":true},{"id":"75ac6fcd.2d15a","type":"switch","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"True","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":140,"wires":[["77fc3491.bde72c"]]},{"id":"24889f71.04343","type":"mqtt in","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Back Door","topic":"zwave/Door/Back/48/1/0","qos":"1","datatype":"json","broker":"5d1bb4a1.a59df4","x":240,"y":380,"wires":[["ef849efa.988588"]]},{"id":"c1aa7528.eed688","type":"mqtt in","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"OHD 2","topic":"zwave/Door/Garrett/48/1/0","qos":"1","datatype":"json","broker":"5d1bb4a1.a59df4","x":230,"y":320,"wires":[["ef849efa.988588"]]},{"id":"75bafd68.9f5a44","type":"mqtt in","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Front Door","topic":"zwave/Door/Front/48/1/0","qos":"1","datatype":"json","broker":"5d1bb4a1.a59df4","x":240,"y":440,"wires":[["ef849efa.988588"]]},{"id":"407dfc4a.f688a4","type":"mqtt in","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Garage Door","topic":"zwave/Door/Garage/48/1/0","qos":"1","datatype":"json","broker":"5d1bb4a1.a59df4","x":250,"y":200,"wires":[["36f928bd.7e43a8"]]},{"id":"36f928bd.7e43a8","type":"switch","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"True","property":"payload.value","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":200,"wires":[["77fc3491.bde72c","32c7b07d.721ae"]]},{"id":"5e6cb16f.1f8498","type":"mqtt in","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Z-wave Motion","topic":"zwave/Motion/+/event","qos":"1","datatype":"json","broker":"5d1bb4a1.a59df4","x":260,"y":80,"wires":[["9c881e5a.7fb18"]]},{"id":"77fc3491.bde72c","type":"AnamicoAlarmSensor","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Home alarm","panel":"2ac90055.7f83e8","alarmStates":["0"],"triggerType":"","x":830,"y":100,"wires":[]},{"id":"32c7b07d.721ae","type":"AnamicoAlarmSensor","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Away alarm","panel":"2ac90055.7f83e8","alarmStates":"1","triggerType":"","x":830,"y":160,"wires":[]},{"id":"68819d8.8e14f64","type":"AnamicoAlarmSensor","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Night alarm","panel":"2ac90055.7f83e8","alarmStates":["2"],"triggerType":"","x":830,"y":220,"wires":[]},{"id":"92de6221.cbc158","type":"AnamicoAlarmSensor","z":"87e774f7.91d8f8","g":"c331e1c0.8e1d68","name":"Off alarm","panel":"2ac90055.7f83e8","alarmStates":["3"],"triggerType":"","x":820,"y":280,"wires":[]}]