A couple of us (@dynamicdave @krambriw and myself) put together a node-red Home Security System. You might find it informative to look as.