You need to connect the relay connections of the PIR to a data pin and an input pin on the parallel port (I used pins 9 and 10), of course you also need to provide power to the PIR (usually 12v). Be careful when doing this because a short could fry either your parallel port or your motherboard, might be an idea to test it with an old pc or use a PCI parallel port card if you are not too sure what you are doing. You then need to check that opt_triggers is enabled in options->system. I then wrote this crude program in python to send a message to zmtrigger to start and stop the alarm events.
Code: Select all
#! /usr/bin/env python
import sys
from socket import *
import parallel
import time
PORT = 6802
HOST = 'localhost'
MONITOR_ID = "6"
def raise_alarm():
s = socket(AF_INET, SOCK_STREAM)
s.connect((HOST, PORT))
s.send(MONITOR_ID + "|on|255|entrance|frontdoor");
s.close()
#print "alarm raised"
def clear_alarm():
s = socket(AF_INET, SOCK_STREAM)
s.connect((HOST, PORT))
s.send(MONITOR_ID + "|off|255|entrance|frontdoor");
s.close()
#print "alarm cleared"
p = parallel.Parallel()
p.setData(0)
#print p.getInAcknowledge()
alarm_raised = 0
while (1):
while (p.getInAcknowledge() == True):
if (alarm_raised == 0):
raise_alarm()
alarm_raised = 1
time.sleep(5)
if (alarm_raised == 1):
clear_alarm()
alarm_raised = 0
time.sleep(0.5)
You will probably have to install pyparallel and then do rmmod lp and modprobe ppdev to get this program to work.
Set the monitor to nodect in zm and then run this program in the background.
Like I said earlier you can fry your parallel port or motherboard if you make a mistake so although I have had no problems with this you do it at your own risk.