[How-To] Control an Elk M1 via External Perl Scripting

Hello,

I would like to setup a Central Station to receive alarms from my Elk M1G. Have you looked into the protocol at all yet? Would you happen to know where I can find out more? Page 16 and 17 of the RS-232 Protocol guide indicates the protocol, but I am missing something. Section 4.4.2 states "This acknowledgement is sent to the M1 only if the central station's server acknowledges the Ethernet Module's data packet." How does the Central Server acknowledge those packets, with an "ar" command? I would like to expand upon the work you have already done with ELKM1::Control since the Elk appears to be a little limited. For example, I would like to run this on a home computer and do the following:

*Trigger Alarm
*Elk connects to Central Server (my server with daemon)
*Server receives alarm
*Server queries last message/log
*Server queries additional items
*Server closes communications
*Have a host of if/then/else abilities
-Like the ability to send an email/SMS with variables in it like "$EVENT ($SENSOR) ($TEMPERATURE)", etc. to more than 16 different locations, etc.

I have configured a Central Station and I use Netcat (nc) on my Mac or Linux box to try and see the output (e.g. nc -l -p [port]). The panel connects, but there is no output. I even used tcpdump to no avail.

Any ideas?

Thanks,
Brad
 
Well, looks like no one else is interested, ...
Anyone have anything else they would like to see?

Not so fast! I´m interested too. I have always been reluctant to keep a PC ON all the time. However, the netbooks are a good low power alternative to home automation. I have an ASUS 701 in which I installed MisterHouse last week but, I get nothing if I cannot make it to talk to my M1.

The ElkM1 wiki page at Misterhouse mentions this module and makes some reference at using it with a serial interface, but in reality it provides no guidance on how to use this module within Misterhouse - much less using the ethernet interface. Since I have no experience in Misterhouse yet, and absolutely no knowledge in Perl, I would like to see some guidance on how to configure Misterhouse to use this module. I dont need anything too fancy. Just some basic example/guidance so that I can continue building on it.

I know that this departs a little from the original topic, so you might want to reply in a separate thread to keep this module thread architecture neutral.
 
The ElkM1 wiki page at Misterhouse mentions this module and makes some reference at using it with a serial interface, but in reality it provides no guidance on how to use this module within Misterhouse - much less using the ethernet interface. Since I have no experience in Misterhouse yet, and absolutely no knowledge in Perl, I would like to see some guidance on how to configure Misterhouse to use this module. I dont need anything too fancy. Just some basic example/guidance so that I can continue building on it.
About all I can add is that the Elk-M1 Perl script works just dandy over tcp/ip. Very well in fact.

Second, I have never used MH, so I'm no help in that department. Anyone else?
 
What does this Rails app you have do exactly? Can I download it somewhere? Will it run using the latest version of Rails?

I'm logging all of my Brultech data to a database also, it might be cool to get the Elk data and the Brultech data into a single web app.
 
What does this Rails app you have do exactly? Can I download it somewhere? Will it run using the latest version of Rails?
It basically outputs a lot of graphs based on your thermostat data and zone data. Simple statistics as well. Nice if you want to see trends in activity and temps.

If you are on windows, then running a rails app is in the intermediate skill range. Easy for linux or Mac. I have it running on rails 2.1.0, but it should be simple to move up to 2.3.2. Uses Open Flash Chart for the graphs.

I haven't made it available because I wrote it for me and my setup. With some arm twisting, I might move it on to github if others are really interested.
 
Twist ;)

I've run and written Rails apps before, I shouldn't have much trouble making it work. I'll likely throw it on either a linux or FreeBSD box.
 

Jeez, that came fast :D

Give me a bit of time and I'll bump it up to rails 2.3.2, OFC2, and try to make it a bit easier to adapt to other setups.

Doesn't sound like it's going to be a problem with signal15 or roussell, but for others that are interested you will have to be comfortable doing some basic config editing and rails/ruby experience will be helpful.

Oh yea, this was pretty much thrown together late nights, so don't expect any modicum of rails programming prowess.
 
Whoops, didn't realize you were still waiting for a reply on this. Yes, I'm still interested. This looks like the perfect thing to add my brultech stats to also.
 
Whoops, didn't realize you were still waiting for a reply on this. Yes, I'm still interested. This looks like the perfect thing to add my brultech stats to also.
Headed out for a Cub Scout camp-out. Be back Monday and I'll put her up on github.
 
For those of you wanting a way to access your ElkM1 via the Serial port here's another option.

If you have a linux computer connected (via serial cable) to the ElkM1 you can use the linux tool "socat" to redirect TCP packets to the Serial interface.

Then you could use the Perl script here (I assume, haven't actually tried it) to connect via TCP to the Serial port.

You can also use ElkRP (I've tested this) to connect from any computer on your network to the ElkM1.

This supports simultaneous connections to the M1 too. Though all connections will receive anything the M1 outputs. But you could use one connection to log everything, another to do some automation tasks, and still be able to connect via the ElkRP. Anyhow, here's the commands I use.

This connects to the ElkM1 on COM1 or /dev/ttyS0. You may need to modify it to point to the correct device on your system. Once done with these two commands you can connect to that linux computer on port 9750 with the ElkRP or any other software to communicate with the ElkM1. You can use any port you want, just change the 9750 below to the port you want to use. Special thanks to Gerhard Rieger w/ socat for helping me get the right commands to do this.

socat /dev/ttyS0,raw,b115200 ip-datagram:127.0.0.2:250,bind=127.0.0.1 &
socat tcp-l:9750,reuseaddr,fork ip-datagram:127.0.0.1:250,bind=127.0.0.2 &
 
Back
Top