Create text file based on Zone condition

sixburg

Member
Is there a way to output a text file from the Elk M1 based on some condition like the status of a zone?  
 
What I'm trying to accomplish is to notify network PCs of the status of a zone.  To keep it simple I was thinking to send a simple text file when the zone changes condition from secure to nonsecure
 
I have an XEP as well.  
 
Thanks,
-Lloyd
 
Depends on what you're attempting to really do.
 
The application notes have a lot on them, and you'd be able to generate ASCII text output through a serial. Direct to a .TXT wouldn't be possible without some back end programming on the host machines.
 
in this 'send' is the tricky part. do you mean
  • send via email
  • send via sms
  • text file appears in a well known location on each machine's disk
  • text file appears in common network location
  • text string appears on a listening socket
  • ?
 
Hi...
Thanks for the responses.  Let me remove the "send" from the equation. All I'd like to do is write a simple file to any PC on the network--once done simple file sharing will enable the others to read the file.  
 
The content of the file is binary -- either a zone is secure or it's not.  Right now that information is only known to the M1.  I have limited Elk programming experience and haven't found any I/O capabilities or commands.  
 
I've considered the email / text idea, but in my experience the timing of receipt of the email is suspect.  The zone status needs to be known reliably and quickly.  
 
If only the Elk RP 'language' had the ability to do something like "Whenever Zone 1 is secure, then send a notification to an IP address'.  The machine at the IP could react accordingly.  
 
I'll try the email thing to see how reliably it works.  
 
I'm not sure this will work for you (the number of zones you monitor may be limited to the 30 text inputs available and you will need to write some rules), but I was dinking around in the Elk ASCII RS 232 protocol and found the following.  YMMV and good luck:
 
"4.3  Send ASCII String To IP Address (AP)
The AP command allows you to send a custom ASCII string message via TCP/IP to a specific IP address on a specific port. To accomplish this, you need to create a TEXT string in the Automation/Text section of ELKRP which is stored in the M1. This text string will consist of the message to send plus some destination information.
One of the eight Central Station IP Receiver addresses programmed in the M1XEP must be used (Central Station tab on the M1XEP Setup dialog in ElkRP). If used for this command, that IP address may not be used for reporting alarms and other events to a Central Station.
To enter the Central Station's IP address on the M1XEP Setup dialog in ElkRP, a "Telephone Number" must be enabled with a "Reporting Format" of "6 = Ethernet M1XEP". Since this Telephone Number cannot be used for reporting alarms and other events MAKE certain to uncheck all Area blocks as well as the Events to be reported blocks on this screen.
Then create a TEXT string and store it in the M1’s Automation/Text section:
 
00APxDDDD… {up to 200 ASCII chars here} CRLF
 
00 - two zeros. Any two digits will work, but they are ignored.
AP - Command to send text string.
x - ASCII "1" - "8". This tells the M1XEP which Central Station IP address to use. Corresponds to Telephone 1-8.
DDDD… - ASCII text data
CRLF - Carriage Return/Line Feed
 
EXAMPLE: 00AP4Sprinkler 1 ON^M^J     Build a text string and store in the M1’s Automation/Text section using ELKRP. “^M^J” is a carriage return/line feed.
 
The example will send “Sprinkler 1 ON” to the IP address programmed as telephone number 4.
 
Write a RULE to send this text string out serial port 0. When the M1XEP receives it, it will look 
up the specified Central Station IP address/port and send only the ASCII message in a TCP packet to 
that address/port. Note that the text string has two parts, a command and a message. 00AP4 is the
command and the rest is the message. The M1XEP splits the message from the command and forwards the 
message part only. Therefore, if you are receiving the message at another M1, the string to match 
is the message part only. In the example above, that would be Sprinkler 1 ON^M^J. So to receive 
this message at another M1, simply create a text string with Sprinkler 1 ON^M^J and write a RULE to 
perform some action when that text string is received through serial port 0."
 

 

 
 
SixBurg - TurboSam's approach is the 'listening on a socket' option from my posting above.
what OS are using where you want the status file? There are a few ELK libraries, but there are also lower level tools.
 
netcat
tcpdump
 
etc. I just peeked and there are windows ports of these.
 
so from the netcat ( nc ) man page there is this example:

DATA TRANSFER
The example in the previous section can be expanded to build a basic data transfer model. Any information input into one end of the connection will be output to the other end, and input and output can be easily captured in order to emulate file transfer.
 
Start by using nc to listen on a specific port, with output captured into a file:
 

$ nc -l 1234 > filename.out

 
Using a second machine, connect to the listening nc process, feeding it the file which is to be transferred:
 

$ nc -N host.example.com 1234 < filename.in

 
After the file has been transferred, the connection will close automatically.
 
of which I think only the first part is what you're thinking of. The second part is interesting and you could use it as a way of testing before listening to the Elk.
 
BaduFamily & TurboSam...
 
Yes, I think at the base you're talking about similar approached--I just need to mess with it to figure out how to implement.  As of right now I've no idea about netcat and tcpdump, but will research that.  
 
The system is relatively simple with an M1 + EXP and several Win 7/8 PCs on the same LAN.  I call one of these PCs the "main".  If the main can know the status of just one zone that info can be passed to all the others so they will know too.  I would simply send some simple status message like "secure" or "unsecure" and the listening PCs can react accordingly.  
 
I was able to simply use Telenet to create  .txt log of  the ASCII strings coming off the M1, so it's a start.  I need to figure out how to get timestamps on each line / string, then read the file and go from there.  For example, the simple test I conducted is the following command and contents of the .txt:
 
telnet 192.168.1.11 1234 -f test.txt
 
The test.txt file contents:
0FXX001closed006F
0FXX002Secure0081
0FXX001closed006F
0FXX002Secure0081
0FXX001closed006F
0FXX002Secure0081
0FXX001closed006F
0FXX002Secure0081
16XK44140941603161100069
0FXX001closed006F
0FXX002Secure0081
0FXX001closed006F
0FXX002Secure0081
0FXX001closed006F
0FXX002Secure0081
0FXX001closed006F
 
The good news is these are the data I'm trying to see.  the strings containing "Secure" let me know that over this timeframe (approximately 10 seconds) the zone is secure.  Looks like now I have both an issue of getting a timestamp, and a parsing issue since the "closed" string is mixed in with the "secure" string.
 
Thanks for your help so far.
 
yes this will work too; you are essentially implementing an event listener. Have fun!
 
IIRC there are Perl and Node.js (javascript) language libraries which would give you a leg up if you can do a bit of programming. I am using Elkington, a Node.js library to connect to the M1 in our house.
 
double check that your telnet session doesn't interfere with the Elk management software.
 
Back
Top