How do I "send" text over TCP from ELK?

Big517

Active Member
Hello All
 
I've searched the forums all morning but cannot find an explanation on how to send a text string from ELK to another device on my network;
 
Basics;
 
I need to send this text: "What's Up{tone:2}"  --
to this IP: 192.168.1.5
on TCP Port 3000.
 
I'm basically bypassing the VeraAlerts plugin in my VERA by communicating the text to be announced directly to my android phone.  
For reference here is the LUA code to accomplish this on another system;
 

function VeraAlert(Host, Port, Msg)
local socket = require("socket")
local tcp = socket.tcp()
tcp:settimeout(3)
if (tcp:connect(Host, Port)) then
if (tcp:send(Msg)) then
else
print("Error Sending Msg")
end
else
print("Error Opening Socket")
end
tcp:close(socket)
end

VeraAlert("192.168.10.101", 3000, "What's Up{tone:2}")




 
 
Thanks in advance
 
You can't really.  All you can do is broadcast that text to serial port 0, and any system connected to this port will see this text.
 
If you can establish a TCP connection from 192.168.1.5 to the M1, you should be all set, you do not need to deal with checksums, handshakes, etc.  The connection should stay open (but you will see other M1 related traffic, so make sure to ignore that).
 
Actually, you can if you have an M1xep.

See "Send ASCII String to IP Address(AP)" in the "M1 Control RS-232 ASCII String Protocol". It is on page 16 of rev. 1.81, pub. date Aug 8, 2011.
 
You're right, last time I did any major reading of this document (years ago), this feature didn't exist.  Very useful.
 
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. 
 
Before isy came out with there elk module, I was using this feature to update some variables on the isy. I don't remember all of the details, but i do recall it being very finicky to set up, but i was able to make it work. However, now that isy has the elk module, I no longer use this.
 
Great reply, and thanks for the follow up with the context from the manual, I must have had the old manual also because i've been searching for that.  Works great! Thanks!
 
I didn't know you could do this.  One interesting thing about this is that you may actually be able to send an HTTP POST or GET request to another system to fire something off.
 
I'm going to use this to power off my Denon receiver (which will then power off my projector via the trigger wire). Thanks!
 
It has a very simple (yet powerful) TCP protocol that can be used to control basically every setting on the receiver. I currently use this on my Linux box via a cron job to make sure my receiver and projector are powered off at night:
 
$ cat /usr/local/sbin/poweroff-denon.sh
#!/bin/sh

if ping -c 1 -q denon &> /dev/null ; then
    echo -en "PWSTANDBY\r" | nc denon 23
fi

 
 
Back
Top