AnotherOne
Active Member
I've been trying to figure out how to track when people come in and out of the house and after talking to one of my web programming friends, he pointed me to a simple example written in Python that allows me to open the non-secured ethernet port and log all the data. Python is free from the download site and seems pretty easy to use.
Here's a simple module to read all the data and time stamp it:
#python module to read Elk M1 data over non-secure ethernet port
import socket
from time import localtime, strftime
import datetime
mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
# connect to the socket 'IP Address', port
# CHANGE IP ADDRESS
mySocket.connect ( ( '192.168.254.6', 2101 ) )
while 1 : #loop forever
data = mySocket.recv (220)
print (strftime("%a %d %b %Y %H:%M:%S", localtime()), data)
mySocket.close()
Which yields data like this:
('Wed 08 Nov 2006 08:41:48', '16XK2341084081106010006F')
('Wed 08 Nov 2006 08:41:48', '\r\n')
('Wed 08 Nov 2006 08:42:08', '0AZC040900C5\r\n')
('Wed 08 Nov 2006 08:42:10', '0AZC040200CC\r\n')
My full blown python module logs everything to both a file and displays it in a Windows XP command window (this will run on linux, etc as well) like this:
Wed 08 Nov 2006 09:59:51 Temp Mudroom 68
Wed 08 Nov 2006 10:00:01 Temp Outside Sensor 48
Wed 08 Nov 2006 10:00:06 Temp Basement 69
Wed 08 Nov 2006 10:00:27 Zone Kitchen Motion Violated
Wed 08 Nov 2006 10:00:30 Zone Kitchen Motion Normal
Wed 08 Nov 2006 10:00:32 Zone Dine Hall Motion Violated
Wed 08 Nov 2006 10:00:33 Zone Dine Hall Motion Normal
If you'd like a copy of the full blown logger, it's about 350 lines. Send me an email to first name: fred last name: hillen.
Email is firstname.lastname at gmail.com and you can modify it to your hearts content. By the way, it should be able to change this to work with the serial port as well, but you have to do reads instead of receives.
Here's a simple module to read all the data and time stamp it:
#python module to read Elk M1 data over non-secure ethernet port
import socket
from time import localtime, strftime
import datetime
mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
# connect to the socket 'IP Address', port
# CHANGE IP ADDRESS
mySocket.connect ( ( '192.168.254.6', 2101 ) )
while 1 : #loop forever
data = mySocket.recv (220)
print (strftime("%a %d %b %Y %H:%M:%S", localtime()), data)
mySocket.close()
Which yields data like this:
('Wed 08 Nov 2006 08:41:48', '16XK2341084081106010006F')
('Wed 08 Nov 2006 08:41:48', '\r\n')
('Wed 08 Nov 2006 08:42:08', '0AZC040900C5\r\n')
('Wed 08 Nov 2006 08:42:10', '0AZC040200CC\r\n')
My full blown python module logs everything to both a file and displays it in a Windows XP command window (this will run on linux, etc as well) like this:
Wed 08 Nov 2006 09:59:51 Temp Mudroom 68
Wed 08 Nov 2006 10:00:01 Temp Outside Sensor 48
Wed 08 Nov 2006 10:00:06 Temp Basement 69
Wed 08 Nov 2006 10:00:27 Zone Kitchen Motion Violated
Wed 08 Nov 2006 10:00:30 Zone Kitchen Motion Normal
Wed 08 Nov 2006 10:00:32 Zone Dine Hall Motion Violated
Wed 08 Nov 2006 10:00:33 Zone Dine Hall Motion Normal
If you'd like a copy of the full blown logger, it's about 350 lines. Send me an email to first name: fred last name: hillen.
Email is firstname.lastname at gmail.com and you can modify it to your hearts content. By the way, it should be able to change this to work with the serial port as well, but you have to do reads instead of receives.